图像配准找到特征点后,怎么对两幅图像的重叠部分对齐融合?已经写好了如下程序,怎么写下去

Shierlybaby 2016-04-22 09:50:26
#include<iostream>
#include <opencv2/opencv.hpp>
#include<string.h>
#include <stdio.h>
#include <opencv2/nonfree/features2d.hpp>

using namespace cv;
using namespace std;

int main(int argc, char* argv[])
{
/*Mat img1=imread("Image01.jpg");*/
Mat img1=imread("1.jpg");
/*Mat img2=imread("Image02.jpg");*/
Mat img2=imread("2.jpg");
//cvtColor(img1,img1,CV_RGB2GRAY);
//cvtColor(img2,img2,CV_RGB2GRAY);

//-- Step 1: Detect the keypoints using SURF Detector检测关键点
int minHessian=400;
SurfFeatureDetector detector( minHessian );
std::vector<KeyPoint> keypoints_1, keypoints_2;//向量类
detector.detect( img1, keypoints_1 );
detector.detect( img2, keypoints_2 );

//-- Step 2: Calculate descriptors (feature vectors)计算描述子
SurfDescriptorExtractor extractor;
Mat descriptors_1, descriptors_2;//两个矩阵
extractor.compute( img1, keypoints_1, descriptors_1 );//把图一的关键点放在描述子这个矩阵中?
extractor.compute( img2, keypoints_2, descriptors_2 );

//-- Step 3: Matching descriptor vectors using FLANN matcher使用FLANN匹配器匹配描述子向量
FlannBasedMatcher matcher;
// BruteForceMatcher<L2<float>> matcher;
std::vector< DMatch > matches;//匹配点(向量)?
matcher.match( descriptors_1, descriptors_2, matches );//把匹配的描述子……

Mat imgMatches;
drawMatches(img1, keypoints_1, img2, keypoints_2, matches, imgMatches);
namedWindow("Matches");
imshow("Matches", imgMatches);///全部的匹配向量
}
...全文
2172 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_42724788 2019-10-11
  • 打赏
  • 举报
回复
匹配点已经写好了,开始进行转换矩阵的求取,对准后再融合
  • 打赏
  • 举报
回复
是否可以将参考图像与配准图像放在同一坐标系。然后将配准图像投影变换。
Shierlybaby 2016-05-16
  • 打赏
  • 举报
回复
暖贴!!! 求助!!! 怎么写下去!!!
Shierlybaby 2016-04-27
  • 打赏
  • 举报
回复
暖贴 不要沉啊 求个人帮帮我吧
yanghuan123195 2016-04-26
  • 打赏
  • 举报
回复
同问请问你弄懂了吗
Shierlybaby 2016-04-22
  • 打赏
  • 举报
回复
初学者 不太能自己写程序 只能看懂程序的程度

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧