首页 > 代码库 > 用轮廓树(CvContourTree)来描述两个轮廓的相似度量度

用轮廓树(CvContourTree)来描述两个轮廓的相似度量度

#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
#include <iostream>
#include "function.h"
int MatchContour(int argc,char** argv)
{
IplImage *Src1=cvLoadImage("e:\\picture\\jiantou.jpg",0);
IplImage *Src2=cvLoadImage("e:\\picture\\jiantou2.jpg",0);
IplImage *BinaryImage1=cvCreateImage(cvGetSize(Src1),Src1->depth,1);
IplImage *BinaryImage2=cvCreateImage(cvGetSize(Src2),Src2->depth,1);
IplImage *SrcColor1=cvCreateImage(cvGetSize(Src1),Src1->depth,3);
IplImage *SrcColor2=cvCreateImage(cvGetSize(Src2),Src2->depth,3);
cvThreshold(Src1,BinaryImage1,100,255,CV_THRESH_BINARY);
cvThreshold(Src2,BinaryImage2,100,255,CV_THRESH_BINARY);
CvMemStorage* storage1=cvCreateMemStorage(0);
CvMemStorage* storage2=cvCreateMemStorage(0);
CvSeq* ContourSeq1=NULL;
CvSeq* ContourSeq2=NULL;
cvFindContours(BinaryImage1,storage1,&ContourSeq1,sizeof(CvContour));
cvFindContours(BinaryImage2,storage2,&ContourSeq2,sizeof(CvContour));
cvCvtColor(Src1,SrcColor1,CV_GRAY2BGR);
cvCvtColor(Src2,SrcColor2,CV_GRAY2BGR);
cvDrawContours(
return 0;
}


本文出自 “flyclc” 博客,请务必保留此出处http://flyclc.blog.51cto.com/1385758/1539755