OpenCV 轮廓检测
使用OpenCV可以对图像的轮廓进行检测。这是之前用过的代码,挺简单的,回顾一下。主要要进行以下2步操作: 1.cvThreshold():对图像进行二值化处理 2.cvFindContours():查找图像轮廓 注意:这个过程中图像要转化为灰度图。 /*********************************************************************** 雷霄骅 ***********************************************************************/ #include "stdafx.h" #include "cv.h" #include "cxcore.h" #include "highgui.h" int main( int argc, char** argv ) { //声明IplImage指针 IplImage* pImg = NULL; IplImage* pContourImg = NULL; CvMemStorage * storage = cvCreateMemStorage(0); CvSeq * contour = 0; int mode = CV_RETR_EXTERNAL; if( argc == 3) if(strcmp(argv[2], "all") == 0