资源简介
两个文件夹,一个为sift+ransac图像匹配代码,同时还有匹配精度检测代码(以像素精度)。另一个文件夹为surf图像匹配代码。
代码片段和文件信息
#include
#include
#include
#include
#include
#include
using namespace std;
using namespace cv;
using namespace cv::xfeatures2d;
Point2f getTransformPoint(const Point2f originalPoint const Mat &transformMaxtri);
int main()
{
//Mat srcImage1 = imread(“D:\\opencv\\pictures\\SIFT_try\\1.png“);
Mat srcImage1 = imread(“D:\\研一文件夹\\上学期\\迷之课设\\课程设计\\demo-data\\im44.jpg“);
//Mat srcImage1 = imread(“D:\\研一文件夹\\上学期\\迷之课设\\课程设计\\demo-data\\building01.png“);
//Mat srcImage1 = imread(“D:\\opencv\\pictures\\视频采集\\35.jpg“);
//Mat srcImage1 = imread(“D:\\opencv\\pictures\\视频采集\\headPose_1.jpg“);
//Mat srcImage1 = imread(“D:\\opencv\\pictures\\eye_close.jpg“);
//Mat srcImage2 = imread(“D:\\opencv\\pictures\\视频采集\\headPose_2.jpg“);
//Mat srcImage2= imread(“D:\\opencv\\pictures\\视频采集\\79.jpg“);
//Mat srcImage2 = imread(“D:\\opencv\\pictures\\SIFT_try\\2.png“);
Mat srcImage2 = imread(“D:\\研一文件夹\\上学期\\迷之课设\\课程设计\\demo-data\\im54.jpg“);
//Mat srcImage2 = imread(“D:\\研一文件夹\\上学期\\迷之课设\\课程设计\\demo-data\\building02.png“);
if (!srcImage1.data || !srcImage2.data)
{
cout << “读取图片出错“ << endl;
return false;
}
imshow(“原始图1“ srcImage1);
imshow(“原始图2“ srcImage2);
////原?
//int minHessian = 100;
////改
int minHessian = 700;
Ptr detector = SurfFeatureDetector::create(minHessian);
vector key_points_1 key_points_2;
Mat dstImage1 dstImage2;
detector->detectAndCompute(srcImage1 Mat() key_points_1 dstImage1);
detector->detectAndCompute(srcImage2 Mat() key_points_2 dstImage2);//可以分成detect和compute
Mat img_keypoints_1 img_keypoints_2;
drawKeypoints(srcImage1 key_points_1 img_keypoints_1 Scalar::all(-1) DrawMatchesFlags::DEFAULT);
drawKeypoints(srcImage2 key_points_2 img_keypoints_2 Scalar::all(-1) DrawMatchesFlags::DEFAULT);
PtrriptorMatcher> matcher = DescriptorMatcher::create(“Flannbased“);
vectormach;
matcher->match(dstImage1 dstImage2 mach);
double Max_dist = 0;
double Min_dist = 100;
for (int i = 0; i < dstImage1.rows; i++)
{
double dist = mach[i].distance;
if (dist < Min_dist)Min_dist = dist;
if (dist > Max_dist)Max_dist = dist;
}
cout << “最短距离“ << Min_dist << endl;
cout << “最长距离“ << Max_dist << endl;
vectorgoodmaches;
for (int i = 0; i < dstImage1.rows; i++)
{
if (mach[i].distance < 2 * Min_dist)
goodmaches.push_back(mach[i]);
}
////改开始
cout << “matches size: “ << key_points_1.size()<< endl;
cout << “good matches size: “ << goodmaches.size()<< endl;
vector RAN_KP1 RAN_KP2;
for (size_t i = 0; i < goodmaches.size(); i++)
{
RAN_KP1.push_back(key_points_1[goodmaches[i].queryIdx]);
RAN_KP2.push_back(key_points_2[goodmaches[i].trainIdx]);
//RAN_KP1是要存储img01中能与img02匹配的点
//goodM
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5113 2019-01-09 15:34 sift+surf匹配代码\SIFT_RANSAC\main.cpp
文件 2603 2018-11-07 22:58 sift+surf匹配代码\SIFT_RANSAC\timer.cpp
文件 12404 2019-01-09 21:54 sift+surf匹配代码\SURF\main.cpp
目录 0 2019-03-24 13:07 sift+surf匹配代码\SIFT_RANSAC
目录 0 2019-03-24 13:07 sift+surf匹配代码\SURF
目录 0 2019-03-24 13:07 sift+surf匹配代码
----------- --------- ---------- ----- ----
20120 6
相关资源
- 航拍图片全景拼接代码
- IEEE transaction 模板
- sift动态背景下实现目标跟踪
- RANSAC&OLS
- TCPIP Illustrated Volume 3 - TCP for Transacti
- OpenCV3.0实现SIFT特征提取+RANSAC剔除误匹
- David G.Lowe的sift算法中文翻译
- Halcon图像匹配处理例程
- SIFT opencv 源代码
- 图像匹配
- featerMatch.rar
- 基于opencv的模板匹配
- sift和surf的比较
- 基于SIFT的图像拼接算法
- openCV SURF 算法对两幅图像匹配并用加
- sift算法实现双目测距
- CUDA加速实现的sift图像配准+颜色校正
- 基于SURF的RANSAC图像细配准
- sift和颜色直方图特征匹配
- SIFT实现特征点提取和匹配
- PCA-SIFT源码
- 基于遗传算法的图像匹配问题
- ASIFT
- RANSAC 提纯算法
- 数字摄影测量图像匹配
- 全景图像拼接基于SIFT特征-Qt工程
评论
共有 条评论