cvCmp和cvCmpS

程序:

wKioL1PsZcHCL_k6AAMNGOR4O7E240.jpg

关键函数:cvCmp和cvCmpS

代码:

#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
#include <iostream>
int cmp(int argc,char** argv)
{
IplImage* src1=cvLoadImage("e:\\picture\\3.jpg",0);
IplImage* src2=cvLoadImage("e:\\picture\\11.jpg",0);
CvRect RectROI=cvRect(200,200,300,300); //设置感兴趣区域
cvSetImageROI(src1,RectROI);
cvSetImageROI(src2,RectROI);
cvNamedWindow("Src1ROI");
cvNamedWindow("Src2ROI");
cvShowImage("Src1ROI",src1);
cvShowImage("Src2ROI",src2);
IplImage* dst=cvCreateImage(cvSize(300,300),8,1);
cvZero(dst);
IplImage* dst2=cvCreateImage(cvGetSize(src1),8,1);
cvZero(dst2);
cvCmp(src1,src2,dst,CV_CMP_GT);
cvCmpS(src1,80,dst2,CV_CMP_LT);
cvResetImageROI(src1);
cvResetImageROI(src2);
cvNamedWindow("result");
cvShowImage("result",dst);
cvNamedWindow("result2");
cvShowImage("result2",dst2);
cvWaitKey(0);
cvDestroyWindow("Src1ROI");
cvDestroyWindow("Src2ROI");
cvDestroyWindow("result");
cvDestroyWindow("result2");
cvReleaseImage(&src1);
cvReleaseImage(&src2);
cvReleaseImage(&dst);
cvReleaseImage(&dst2);
return 0;
}


你可能感兴趣的:(opencv,cvCmpS,cvCmp)