-
大小: 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:“<< matching << endl;
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本
- 下一篇:华为-终端合作手机硬件测试标准
相关资源
- 贾志刚Opencv图像处理视频教程学习笔
- opencv_3rdparty-ffmpeg-master_20161202.zip
- 学习opencv pdf
- vs2010+opencv 图像处理,边缘检测,可设
- OpenCV By Example.pdf
- opencv实现图像旋转任意角度边界正好
- zw_学习OpenCV(中文版).zip
- 学习OpenCV(中文版)pdf155532
- opencv3 神经网络字母识别源码.zip
- lbp特征提取代码
- 图片尺寸与格式转换软件.7z
- opencv 2.3.1
- ippicv_2020_win_intel64_20191018_general.zip
- OPENCV车道检测与车辆识别
- opencv立体匹配算法BM+SGBM+VAR运行官方立
- 基于opencv的手写数字字符识别
- opencv数字识别更新
- OpenCV 2.4.3编译生成的libdllinclude文件
- LearningOpenCV_Code.rar
- qt+opencv+人脸识别
- 《学习opencv中文版》于仕琪著 电子版
- 基于OpenCV的图像识别及跟踪程序
- opencv 2.4.10_vs2008_x86库
- opencv1.0Windows安装版
- opencv 3.4.0 安装需要的东西
- opencv4.2需要的文件.rar
- OpenCV资料
- opencv3.3需要的ippicv_2017u2_mac_intel64_20
- ippicv_2017u3_win_intel64_general_20180518.zip
- 2076个opencv分类器苹果样本及解释文件
评论
共有 条评论