资源简介
获取连通域的长宽周长等信息,效果还不错。
代码片段和文件信息
#include “stdafx.h“
#include “cv.h“
#include “highgui.h“
#include “math.h“
#include
#include
#include
using namespace std;
using namespace cv;
int main()
{
IplImage* img = cvLoadImage(“frame_0002.bmp“);
IplImage* tep = cvLoadImage(“org.jpg“);
CvSeq* contour = 0;
// IplImage* dst = cvCreateImage(cvGetSize(tep) 8 3);
IplImage* teemp = cvCreateImage(cvSize(tep->widthtep->height)IPL_DEPTH_8U1);
CvMemStorage* storage = cvCreateMemStorage(0);
cvNamedWindow(“img“1);
cvNamedWindow(“diff“1);
cvCvtColor(tep teemp CV_BGR2GRAY);
cvThreshold(teempteemp245255CV_THRESH_BINARY);
cvSmooth(teempteempCV_MEDIAN);
int contour_num = cvFindContours(teemp storage &contour sizeof(CvContour) CV_RETR_CCOMP CV_CHAIN_APPROX_SIMPLE);
CvSeq *_contour = co
- 上一篇:梁友栋-Barsky算法
- 下一篇:算法最大K乘积
评论
共有 条评论