#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; }
用轮廓树(CvContourTree)来描述两个轮廓的相似度量度
时间: 2024-11-11 17:55:49