[cpp]view plain
copy
print?
#include
#include
#include
#pragma comment(lib, "cv.lib")
#pragma comment(lib, "cxcore.lib")
#pragma comment(lib, "highgui.lib")
intmain(intargc,char** argv )
cvrect arect = cvboundingrect( contour, 0 );
if((arect.width/arect.height)<1)
if(tmparea > maxarea)
m++;
// 建立乙個色彩值
cvscalar color = cv_rgb( 0, 255, 255 );
//max_level 繪製輪廓的最大等級。如果等級為0,繪製單獨的輪廓。如果為1,繪製輪廓及在其後的相同的級別下輪廓
//如果值為2,所有的輪廓。如果等級為2,繪製所有同級輪廓及所有低一級輪廓,諸此種種
//如果值為負數,函式不繪製同級輪廓,但會公升序繪製直到級別為abs(max_level)-1的子輪廓
cvdrawcontours(dst, contour, color, color, -1, 1, 8); //繪製外部和內部的輪廓
}
contour = _contour;
intcount = 0;
for(; contour != 0; contour = contour->h_next)
}
printf("the total number of contours is:%d"
, count);
cvnamedwindow("components"
, 1);
cvshowimage("components"
, dst);
cvwaitkey(0);
cvdestroywindow("source"
);
cvreleaseimage(&src);
cvdestroywindow("components"
);
cvreleaseimage(&dst);
return0;
}
#include #include #include #pragma comment(lib, "cv.lib")
#pragma comment(lib, "cxcore.lib")
#pragma comment(lib, "highgui.lib")
int main( int argc, char** argv )
cvrect arect = cvboundingrect( contour, 0 );
if ((arect.width/arect.height)<1)
if(tmparea > maxarea)
m++;
// 建立乙個色彩值
cvscalar color = cv_rgb( 0, 255, 255 );
//max_level 繪製輪廓的最大等級。如果等級為0,繪製單獨的輪廓。如果為1,繪製輪廓及在其後的相同的級別下輪廓
//如果值為2,所有的輪廓。如果等級為2,繪製所有同級輪廓及所有低一級輪廓,諸此種種
//如果值為負數,函式不繪製同級輪廓,但會公升序繪製直到級別為abs(max_level)-1的子輪廓
cvdrawcontours(dst, contour, color, color, -1, 1, 8); //繪製外部和內部的輪廓
OpenCV計算連通區域數目與最大連通區域並標示出
include include include pragma comment lib,cv.lib pragma comment lib,cxcore.lib pragma comment lib,highgui.lib intmain intargc,char argv cvrect arect ...
OpenCV計算連通區域數目與最大連通區域並標示出
include include include pragma comment lib,cv.lib pragma comment lib,cxcore.lib pragma comment lib,highgui.lib intmain int argc,char ar cvrect arect c...
python連通區域計算長度 連通區域演算法小結
聯通區域標記 connected component labeling 是影象處理裡面常用的乙個技術,它是用來檢測二值影象中聯通的區域,在許多跟蹤檢測演算法中充當目標區域檢測的作用。常見的ccl connected component labeling 包括two pass的方法和one pass的...