-
大小: 14.7MB文件類型: .rar金幣: 1下載: 0 次發布日期: 2023-06-30
- 語言: 其他
- 標簽: Opencv??MatchShapes??匹配形狀??
資源簡介
介紹如何使用OpenCV中的CvMatchShapes的使用的例程,具體參見:http://blog.csdn.net/xizero00/article/details/7448070
代碼片段和文件信息
#include?“opencv/cv.h“
#include?“opencv/highgui.h“
#include?
using?namespace?std;
int?cvMatchShapes_test1();
int?cvMatchShapes_test2();
int?main(char**?args)
{
cvMatchShapes_test1();
cvMatchShapes_test2();
return?0;
}
int?cvMatchShapes_test1()
{
IplImage?*mode?=?cvLoadImage(“9.bmp“?1);
IplImage?*test?=?cvLoadImage(“18.bmp“?1);
IplImage*?bw_mode?=?cvCreateImage(cvGetSize(mode)mode->depth1);
IplImage*?bw_test?=?cvCreateImage(cvGetSize(test)mode->depth1);
IplImage*?canny_mode?=?cvCreateImage(cvGetSize(mode)mode->depth1);
IplImage*?canny_test?=?cvCreateImage(cvGetSize(test)mode->depth1);
CvMemStorage?*mode_mems=cvCreateMemStorage();
CvSeq?*mode_seqs;
CvMemStorage?*test_mems=cvCreateMemStorage();
CvSeq?*test_seqs;
cvCvtColor(modebw_modeCV_RGB2GRAY);
cvCvtColor(testbw_testCV_RGB2GRAY);
//model?contours
cvCanny(bw_modecanny_mode5060);
cvFindContours(?canny_mode?mode_mems
&mode_seqssizeof(CvContour)CV_RETR_TREE);
//test?contours
cvCanny(bw_testcanny_test5060);
cvFindContours(?canny_test?test_mems
&test_seqssizeof(CvContour)CV_RETR_TREE);
double?matching=cvMatchShapes(?test_seqs?mode_seqs?3);
cout<<“method1:?convert?color?to?gray?->?canny?->?findcontours?->?cvmatchshapes“< cout<<“matching?score:“<
cvReleaseMemStorage(&mode_mems);
cvReleaseMemStorage(&test_mems);
cvReleaseImage(?&mode?);?
cvReleaseImage(?&test?);
cvReleaseImage(?&bw_mode?);
cvReleaseImage(?&bw_test?);
cvReleaseImage(?&canny_mode?);?
cvReleaseImage(?&canny_test?);
cvWaitKey(0);
return?1;
}
int?cvMatchShapes_test2()
{
IplImage*?mode?=?cvLoadImage(“9.bmp“1);
IplImage*?test?=?cvLoadImage(“18.bmp“1);
IplImage*?bw_mode?=?cvCreateImage(cvGetSize(mode)mode->depth1);
IplImage*?bw_test?=?cvCreateImage(cvGetSize(test)mode->depth1);
IplImage*?canny_mode?=?cvCreateImage(cvGetSize(mode)mode->depth1);
IplImage*?canny_test?=?cvCreateImage(cvGetSize(test)mode->depth1);
CvMemStorage?*mode_mems=cvCreateMemStorage();
CvSeq?*mode_seqs;
CvMemStorage?*test_mems=cvCreateMemStorage();
CvSeq?*test_seqs;
cvCvtColor(modebw_modeCV_RGB2GRAY);
cvCvtColor(testbw_testCV_RGB2GRAY);
//model?contours
//cvCanny(bw_modecanny_mode5060);
cvFindContours(?bw_mode?mode_mems
&mode_seqssizeof(CvContour)CV_RETR_TREE);
//test?contours
//cvCanny(bw_testcanny_test5060);
cvFindContours(?bw_test?test_mems
&test_seqssizeof(CvContour)CV_RETR_TREE);
double?matching=cvMatchShapes(?test_seqs?mode_seqs?3);
cout<<“method2:?convert?color?to?gray?->?findcontours?->?cvmatchshapes“< cout<<“matching?score:“<
cvWaitKey(0);
cvReleaseMemStorage(&mode_mems);
cvReleaseMemStorage(&test_mems);
cvReleaseImage(?&mode?);?
cvReleaseImage(?&test?);
cvReleaseImage(?&bw_mode?);
cvReleaseImage(?&bw_test?);
cvReleaseImage(?&canny_mode?);?
cvReleaseImag
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????5150??2013-01-12?15:13??temp\18.bmp
?????文件???????5174??2013-01-12?15:13??temp\9.bmp
?????文件???????5150??2013-01-12?15:13??temp\Debug\18.bmp
?????文件???????5174??2013-01-12?15:13??temp\Debug\9.bmp
?????文件???????5150??2013-01-12?15:13??temp\Release\18.bmp
?????文件???????5174??2013-01-12?15:13??temp\Release\9.bmp
?????文件????????872??2013-01-18?15:40??temp\temp.sln
????..A..H.?????15872??2013-01-18?17:15??temp\temp.suo
?????文件???????5493??2013-01-18?16:21??temp\temp.vcproj
?????文件???????3032??2013-01-18?17:00??temp\test.cpp
????.......?????????0??2005-12-08?14:56??temp\test.h
?????文件????1617920??2011-08-01?11:23??temp\vs2005\bin\debug\opencv_calib3d230d.dll
?????文件????1191936??2011-08-01?11:26??temp\vs2005\bin\debug\opencv_contrib230d.dll
?????文件????2875392??2011-08-01?11:21??temp\vs2005\bin\debug\opencv_core230d.dll
?????文件?????311296??2011-08-01?11:26??temp\vs2005\bin\debug\opencv_createsamplesd.exe
?????文件????2027520??2011-08-01?11:22??temp\vs2005\bin\debug\opencv_features2d230d.dll
?????文件????5909072??2011-08-01?11:28??temp\vs2005\bin\debug\opencv_ffmpeg.dll
?????文件?????114688??2011-08-01?11:21??temp\vs2005\bin\debug\opencv_flann230d.dll
?????文件?????659456??2011-08-01?11:24??temp\vs2005\bin\debug\opencv_gpu230d.dll
?????文件?????311296??2011-08-01?11:25??temp\vs2005\bin\debug\opencv_haartrainingd.exe
?????文件????1806336??2011-08-01?11:22??temp\vs2005\bin\debug\opencv_highgui230d.dll
?????文件????2723840??2011-08-01?11:21??temp\vs2005\bin\debug\opencv_imgproc230d.dll
?????文件????1482752??2011-08-01?11:23??temp\vs2005\bin\debug\opencv_legacy230d.dll
?????文件?????942080??2011-08-01?11:22??temp\vs2005\bin\debug\opencv_ml230d.dll
?????文件????1265664??2011-08-01?11:23??temp\vs2005\bin\debug\opencv_objdetect230d.dll
?????文件?????729088??2011-08-01?11:25??temp\vs2005\bin\debug\opencv_stitchingd.exe
?????文件?????937984??2011-08-01?11:25??temp\vs2005\bin\debug\opencv_test_calib3dd.exe
?????文件????1089536??2011-08-01?11:25??temp\vs2005\bin\debug\opencv_test_cored.exe
?????文件?????565248??2011-08-01?11:26??temp\vs2005\bin\debug\opencv_test_features2dd.exe
?????文件?????622592??2011-08-01?11:26??temp\vs2005\bin\debug\opencv_test_gpud.exe
............此處省略191個文件信息
- 上一篇:牛津書蟲系列全50本
- 下一篇:華為-終端合作手機硬件測試標準
評論
共有 條評論