91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 5.99MB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2023-08-12
  • 語言: 其他
  • 標簽: SLIC??

資源簡介

超像素圖像分割是對圖像進行分析和理解的關鍵步驟,在圖像處理領域具有重要的研究和應用價值。本題目需要實現一種基于SLIC超像素圖像分割的算法。首先利用SLIC對圖像進行超像素分割處理,把原圖像分割成大小相似、形狀規則的超像素,以超像素中心點的五維特征值作為原始數據點進行聚類,確定多體素數目和分割邊界。SLIC具有以下優勢:1)生成的超像素如同細胞一般緊湊整齊,鄰域特征比較容易表達;2)不僅可以分割彩色圖,也可以兼容分割灰度圖;3)需要設置的參數非常少,默認情況下只需要設置一個預分割的超像素的數量。相比其他的超像素分割方法,SLIC在運行速度、生成超像素的緊湊度、輪廓保持方面都比較理想。

資源截圖

代碼片段和文件信息

#include?“slic.h“

/*
?*?Constructor.?Nothing?is?done?here.
?*/
Slic::Slic()?{

}

/*
?*?Destructor.?Clear?any?present?data.
?*/
Slic::~Slic()?{
????clear_data();
}

/*
?*?Clear?the?data?as?saved?by?the?algorithm.
?*
?*?Input?:?-
?*?Output:?-
?*/
void?Slic::clear_data()?{
????clusters.clear();
????distances.clear();
????centers.clear();
????center_counts.clear();
}

/*
?*?Initialize?the?cluster?centers?and?initial?values?of?the?pixel-wise?cluster
?*?assignment?and?distance?values.
?*
?*?Input?:?The?image?(IplImage*).
?*?Output:?-
?*/
void?Slic::init_data(IplImage?*image)?{
????/*?Initialize?the?cluster?and?distance?matrices.?*/
????for?(int?i?=?0;?i?width;?i++)?{?
????????vector?cr;
????????vector?dr;
????????for?(int?j?=?0;?j?height;?j++)?{
????????????cr.push_back(-1);
????????????dr.push_back(FLT_MAX);
????????}
????????clusters.push_back(cr);
????????distances.push_back(dr);
????}
????
????/*?Initialize?the?centers?and?counters.?*/
????for?(int?i?=?step;?i?width?-?step/2;?i?+=?step)?{
????????for?(int?j?=?step;?j?height?-?step/2;?j?+=?step)?{
????????????vector?center;
????????????/*?Find?the?local?minimum?(gradient-wise).?*/
????????????CvPoint?nc?=?find_local_minimum(image?cvPoint(ij));
????????????CvScalar?colour?=?cvGet2D(image?nc.y?nc.x);
????????????
????????????/*?Generate?the?center?vector.?*/
????????????center.push_back(colour.val[0]);
????????????center.push_back(colour.val[1]);
????????????center.push_back(colour.val[2]);
????????????center.push_back(nc.x);
????????????center.push_back(nc.y);
????????????
????????????/*?Append?to?vector?of?centers.?*/
????????????centers.push_back(center);
????????????center_counts.push_back(0);
????????}
????}
}

/*
?*?Compute?the?distance?between?a?cluster?center?and?an?individual?pixel.
?*
?*?Input?:?The?cluster?index?(int)?the?pixel?(CvPoint)?and?the?Lab?values?of
?*?????????the?pixel?(CvScalar).
?*?Output:?The?distance?(double).
?*/
double?Slic::compute_dist(int?ci?CvPoint?pixel?CvScalar?colour)?{
????double?dc?=?sqrt(pow(centers[ci][0]?-?colour.val[0]?2)?+?pow(centers[ci][1]
????????????-?colour.val[1]?2)?+?pow(centers[ci][2]?-?colour.val[2]?2));
????double?ds?=?sqrt(pow(centers[ci][3]?-?pixel.x?2)?+?pow(centers[ci][4]?-?pixel.y?2));
????
????return?sqrt(pow(dc?/?nc?2)?+?pow(ds?/?ns?2));
????
????//double?w?=?1.0?/?(pow(ns?/?nc?2));
????//return?sqrt(dc)?+?sqrt(ds?*?w);
}

/*
?*?Find?a?local?gradient?minimum?of?a?pixel?in?a?3x3?neighbourhood.?This
?*?method?is?called?upon?initialization?of?the?cluster?centers.
?*
?*?Input?:?The?image?(IplImage*)?and?the?pixel?center?(CvPoint).
?*?Output:?The?local?gradient?minimum?(CvPoint).
?*/
CvPoint?Slic::find_local_minimum(IplImage?*image?CvPoint?center)?{
????double?min_grad?=?FLT_MAX;
????CvPoint?loc_min?=?cvPoint(center.x?center.y);
????
????for?(int?i?=?center.x-1;?i?????????for?(int?j?=?center.y-1;?j?????????????CvScalar?c1?=?cvGet2D

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????1314594??2018-11-07?09:36??SLIC-Superpixels-master\2012-SLIC_superpixels?compared?to?state-of-the-art?superpixel?methods-TPAMI-Achanta12.pdf

????.......????164271??2013-05-13?04:32??SLIC-Superpixels-master\dog.png

????.......?????57263??2013-05-13?04:32??SLIC-Superpixels-master\dog_segmentation.png

????.......???????611??2013-05-13?04:32??SLIC-Superpixels-master\README.md

????.......?????12759??2013-05-13?04:32??SLIC-Superpixels-master\slic.cpp

????.......??????2515??2013-05-13?04:32??SLIC-Superpixels-master\slic.h

????.......??????1217??2013-05-13?04:32??SLIC-Superpixels-master\test_slic.cpp

?????目錄??????????0??2018-11-07?12:15??SLIC-Superpixels-master

-----------?---------??----------?-----??----

??????????????1553230????????????????????8


評論

共有 條評論