OpenCV中提取SIFT特征点、图像匹配、图像配准

在实际中提取图像的sift特征点,再对特征点做匹配,形成特征点对,最后计算图像变换的矩阵,一般为单应矩阵,再利用单应矩阵进行图像的配准,现在基于OpenCV实现相关的算法和步骤,具体代码和主要的函数讲解如下。

一、代码如下:
#include<iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/nonfree/nonfree.hpp>
#include "opencv2/calib3d/calib3d.hpp"
#include <highgui.h>  
#include <cv.h>  
#include<vector>
#include<cmath>

#define PI 3.14159265358979323846264338327950288419716939937510582097
using namespace std;
using namespace cv;

void main()
{   
    //读取原始基准图和待匹配图
    Mat srcImg1 = imread("1.JPG");      //待配准图
    Mat srcImg2 = imread("2.JPG");      //基准图

    //显示基准和待配准图
    imshow("待配准图", srcImg1);
    imshow("基准图", srcImg2);

    //定义SIFT特征检测类对象
    SiftFeatureDetector siftDetector1;
    SiftFeatureDetector siftDetector2;

    //定义KeyPoint变量
    vector<KeyPoint>keyPoints1;
    
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值