图像配准找到特征点后,怎么对两幅图像的重叠部分对齐融合?已经写好了如下程序,怎么写下去
#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);///全部的匹配向量
}
#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);///全部的匹配向量
}
...全文
相关推荐
ENVI图像自动配准教程
- **目的**: 解决实际应用中图像重叠区域因几何校正误差而导致的不匹配问题,适用于图像融合、镶嵌、动态监测等多个应用场景。
基于 C语言 surf 特征点的低重叠度图像拼接
不同的是 Surf 还加入了 Hessian 矩阵迹的判断,如果两个特征点的矩阵迹正负号相同,代表这两个特征具有相同方向上的对比度变化,如果不同,说明这两个特征点的对比度变化方向是相反的,即使欧氏距离为 0,直接予以排除。在建立统一认知的过程中,要考虑的就是在图像在不同的尺度下都存在的特征点。SIFT 算法流程如图 2-2,利用图像金字塔生成尺度空间确定候选点,然后进行非极大值抑制,筛选出真正的特征点,降低运算复杂度,同时精确定位特征点坐标,选取特征点的主方向,最后利用特征点方向构造特征点的描述子。
ENVI5.1图像配准、融合、真色彩增强
#### 二、图像配准和图像融合图像配准是指将两张或多张具有部分或全部重叠区域的图像,通过几何变换等方式,使得这些图像的空间坐标系统达到一致的过程。
图像配准实例matlab
在图像处理领域,图像配准是一项关键的技术,用于将两幅或多幅图像对齐,使得它们在几何上对应。
图像配准技术及其MATLAB编程实现源码及自己测试M文件
图像配准技术是计算机视觉和图像处理领域中的一个重要概念,主要目的是将两幅或多幅图像在几何上对齐,使得它们在共同的空间坐标系统下能够相互对应。


