资源简介
基于OpenCV的实现特征点提取和匹配的程序。
代码片段和文件信息
#include
#include
#include
#include
#include
#include
#include
#include
#include
int main()
{
// Read input images
cv::Mat image1= cv::imread(“OpticalFlow0.jpg“0);
cv::Mat image2= cv::imread(“OpticalFlow1.jpg“0);
if (!image1.data || !image2.data)
return 0;
// Display the images
cv::namedWindow(“Right Image“);
cv::imshow(“Right Image“image1);
cv::namedWindow(“Left Image“);
cv::imshow(“Left Image“image2);
// vector of keypoints
std::vector keypoints1;
std::vector keypoints2;
// Construction of the SURF feature detector
cv::SurfFeatureDetector surf(3000);
// Detection of the SURF features
surf.detect(image1keypoints1);
surf.detect(image2keypoints2);
std::cout << “Number of SURF points (1): “ << keypoints1.size() << std::endl;
std::cout << “Number of SURF points (2): “ << keypoints2.size() << std::endl;
// Draw the kepoints
cv::Mat imageKP;
cv::drawKeypoints(image1keypoints1imageKPcv::Scalar(255255255)cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
cv::namedWindow(“Right SURF Features“);
cv::imshow(“Right SURF Features“imageKP);
cv::drawKeypoints(image2keypoints2imageKPcv::Scalar(255255255)cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
cv::namedWindow(“Left SURF Features“);
cv::imshow(“Left SURF Features“imageKP);
// Construction of the SURF descriptor extractor
cv::SurfDescriptorExtractor surfDesc;
// Extraction of the SURF descriptors
cv::Mat descriptors1 descriptors2;
surfDesc.compute(image1keypoints1descriptors1);
surfDesc.compute(image2keypoints2descriptors2);
std::cout << “descriptor matrix size: “ << descriptors1.rows << “ by “ << descriptors1.cols << std::endl;
// Construction of the matcher
cv::BruteForceMatcher< cv::L2 > matcher;
// Match the two image descriptors
std::vector matches;
matcher.match(descriptors1descriptors2 matches);
std::cout << “Number of matched points: “ << matches.size() << std::endl;
std::nth_element(matches.begin() // initial position
matches.begin()+24 // position of the sorted element
matches.end()); // end position
// remove all elements after the 25th
matches.erase(matches.begin()+25 matches.end());
cv::Mat imageMatches;
cv::drawMatches(image1keypoints1 // 1st image and its keypoints
image2keypoints2 // 2nd image and its keypoints
matches // the matches
imageMatches // the image produced
cv::Scalar(255255255)); // color of the lines
cv::namedWindow(“Matches“);
cv::imshow(“Matches“imageMatches);
cv::waitKey();
return 0;
int size=7;
cv::Mat imaf1;
image1.convertTo(imaf1CV_32F);
cv::
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-01-06 13:25 HW3\
文件 3080 2013-01-04 20:40 HW3\tracking.cpp
文件 124031 2011-01-17 05:45 HW3\church01.jpg
文件 48594 2013-01-04 20:41 HW3\tracking
文件 120223 2008-10-07 17:00 HW3\OpticalFlow1.jpg
文件 115 2013-01-04 19:44 HW3\README
文件 124874 2011-01-17 05:47 HW3\church02.jpg
文件 123322 2008-10-07 17:00 HW3\OpticalFlow0.jpg
- 上一篇:基于单片机的曼彻斯特编码程序
- 下一篇:实现8个LED流水灯汇编语言程
相关资源
- Surface pro 7 SD卡固定硬盘X64驱动带数字
- new surface pro第5代官方最新系统家庭版
- Impact of bond order loss on surface and nanos
- The Rh influence on the surface distribution o
- Orientation-resolved 3d5/2 energy shift of Rh
- Coordination-resolved 4f binding energy shift
- Sub-wavelength surface structuring of NiTi all
- Gold-film coating assisted femtosecond laser f
- Micropackaging of Al2O3 Shell on the Surface o
- THERMAL ANNEALING TREATMENT TO ACHIEVE SWITCHA
- 中国边界BLN文件
- surf 算法论文及代码
- 角点检测与匹配
- 影像匹配、特征点提取、影像相关、
- 论文研究-基于SURF和快速近似最近邻搜
- 论文研究-基于Harris角点和SURF特征的遥
- Differential Geometry of Curves and Surfaces
-
surfaceview+mediapla
yer实现视频播放和动 - Differential Geometry of Curves and Surfaces D
-
MediaPla
yer和SurfaceView的结合使用 - Surface pro 7 SD卡固定硬盘X64驱动带数字
- 数字摄影测量编程实习程序
- 安卓相机代码
- Surfer 7 英文安装版 功能强劲 性能稳定
- SURF源码(opencv中文注释).rar
- 炫酷九宫格抽奖demo
- 特征点提取Moravec、Forstner、Harris算法
- Surfer使用教程
- 可运行1.5.8的Bimserver版本包括插件第四
- SURF论文及源码
评论
共有 条评论