资源简介
该程序调用opencv库函数实现的SIFT特征点提取及匹配,其中有两组图片以供测试。程序配置库为opencv2.4.9+vs2013。

代码片段和文件信息
// sift.cpp : 定义控制台应用程序的入口点。
//
#include “stdafx.h“
#include
#include
#include
#include “opencv2/nonfree/features2d.hpp“//sift 函数
using namespace std;
using namespace cv;
int _tmain(int argc _TCHAR* argv[])
{
CV_EXPORTS_W bool initModule_nonfree();//初始化模块,使用SIFT或SURF时用到
PtrriptorMatcher> siftMatcher = DescriptorMatcher::create(“BruteForce“);//创建特征匹配器暴力匹配(简单匹配)
SiftFeatureDetector siftDetector;//创建SIFT特征检测器
//读入图像
Mat img1 = imread(“p0.png“);
Mat img2 = imread(“p1.png“);
if (img1.empty() || img2.empty())
printf(“picERROR“);
/*特征点检测*/
vector keypoints1 keypoints2;
siftDetector.detect(img1 keypoints1);
siftDetector.detect(img2 keypoints2);
cout << “Number of detected keypoints img1:“ << keypoints1.size() << “points.--- img2:“
<< keypoints2.size() << “points.“ << endl;
/*在图片上显示特征点*/
Mat imgkey1 imgkey2;
drawKeypoints(img1 keypoints1 imgkey1 Scalar::all(-1));
drawKeypoints(img2 keypoints2 imgkey2 Scalar::all(-1));
imshow(“box“ imgkey1);
imshow(“box_in_scene“ imgkey2);
/*特征向量提取*/
SiftDescriptorExtractor siftExtractor;
Mat descriptor1 descriptor2;
siftExtractor.compute(img1 keypoints1 descriptor1);
siftExtractor.compute(img2 keypoints2 descriptor2);
cout << “Number of Descriptors1:“ << descriptor1.rows << endl;
cout << “Number of Descriptors2:“ << descriptor2.rows << endl;
cout << “Demension of sift Descriptors:“ << descriptor1.cols << endl;
/*特征点匹配*/
vector matches;
siftMatcher->match(descriptor1 descriptor2 matches Mat());
/*在图片上显示匹配结果*/
Mat imgmatches;
drawMatches(img1
keypoints1
img2
keypoints2
matches
imgmatches
Scalar::all(-1)
Scalar::all(-1)
vector()
DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS);
imshow(“Match Results:“ imgmatches);
waitKey(0);
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 86528 2018-10-20 14:24 sift\Debug\sift.exe
文件 531352 2018-10-20 14:24 sift\Debug\sift.ilk
文件 1469440 2018-10-20 14:24 sift\Debug\sift.pdb
文件 3080192 2018-10-20 14:23 sift\ipch\sift-ab158830\sift-4d88d322.ipch
文件 903542 2018-10-20 14:17 sift\sift\a0.png
文件 902056 2018-10-20 14:18 sift\sift\a1.png
文件 1748 2018-10-20 14:24 sift\sift\Debug\sift.log
文件 287344 2018-10-20 14:24 sift\sift\Debug\sift.obj
文件 1638400 2018-10-20 14:20 sift\sift\Debug\sift.pch
文件 1270 2018-10-20 14:24 sift\sift\Debug\sift.tlog\cl.command.1.tlog
文件 9378 2018-10-20 14:24 sift\sift\Debug\sift.tlog\CL.read.1.tlog
文件 700 2018-10-20 14:24 sift\sift\Debug\sift.tlog\CL.write.1.tlog
文件 2004 2018-10-20 14:24 sift\sift\Debug\sift.tlog\li
文件 4404 2018-10-20 14:24 sift\sift\Debug\sift.tlog\li
文件 366 2018-10-20 14:24 sift\sift\Debug\sift.tlog\li
文件 155 2018-10-20 14:24 sift\sift\Debug\sift.tlog\sift.lastbuildstate
文件 10973 2018-10-20 14:20 sift\sift\Debug\stdafx.obj
文件 420864 2018-10-20 14:24 sift\sift\Debug\vc120.idb
文件 872448 2018-10-20 14:24 sift\sift\Debug\vc120.pdb
文件 468778 2018-10-20 14:19 sift\sift\p0.png
文件 403011 2018-10-20 14:19 sift\sift\p1.png
文件 1489 2018-10-20 13:56 sift\sift\ReadMe.txt
文件 2001 2018-10-20 14:24 sift\sift\sift.cpp
文件 5367 2018-10-20 14:20 sift\sift\sift.vcxproj
文件 1311 2018-10-20 13:56 sift\sift\sift.vcxproj.filters
文件 210 2018-10-20 13:56 sift\sift\stdafx.cpp
文件 234 2018-10-20 13:56 sift\sift\stdafx.h
文件 236 2018-10-20 13:56 sift\sift\targetver.h
文件 12779520 2018-10-20 14:24 sift\sift.sdf
文件 958 2018-10-20 13:56 sift\sift.sln
............此处省略11个文件信息
- 上一篇:getif-2.3.1
- 下一篇:硬件课程设计-频率发生器
相关资源
- 基于OpenCV的数字识别468815
- 使用opencv去掉二值化图像中黑色面积
- opencv环境配置
- win10 64位下编译的opencv4.5.5库,opencv
- NVIDIAOpticalFlowSDK-79c6cee80a2df9a196f20afd6
- opencv_contrib-3.4.0.zip
- BoW|Pyramid BoW+SVM进行图像分类
- opencv2.4.9源码分析——SIFT
- 用两个摄像头实现,双目标定,双目
- opencv_traincascade训练分类器,手势识别
- opencv3.0交叉编译用parallel.cpp
- 基于opencv的图像识别识别图像中的色
- siftDemoV4.zip
- 基于openCV的识别特定颜色区域
- 基于OpenCV的分水岭算法实现
- QT+opencv+OCR 身份证号码,银行卡号识别
- opencv视频特定颜色区域识别
- 把RGB转换为HSV和HSI然后根据黄色和蓝
- opencv视觉测距
- 基于Qt和opencv的身份证号码识别系统
- opencv_ffmpeg249.dll
- SfM稀疏三维点云重建--完整工程文件
- 基于opencv的数人头程序源代码
- 利用OpenCV中的Stitcher类实现全景图像拼
- 角点检测与匹配
- opencv实现的sift算法源码,包含了图像
- openCV 上的小波变换
- 基于OPENCV的车牌识别系统设计
- 617张国内车牌60-17bmp图片用于OpenCV正样
- hog特征提取,c版本代码
评论
共有 条评论