opencv——SURF特征点检测并使用Flann算法匹配

本文记录了使用OpenCV进行SURF特征点检测并利用Flann算法进行匹配的学习过程,展示了实际运行效果,并介绍了Dmatch数据结构及其相关参数含义。
摘要由CSDN通过智能技术生成

    记录一下学习过程,话不多说贴代码:

#include <opencv2/core/core.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/flann/flann.hpp>
#include <opencv2/xfeatures2d/nonfree.hpp>
#include <opencv2/xfeatures2d.hpp>
#include <iostream>

int main() {
	cv::Mat srcImage1 = cv::imread("img1.png", 1);
	cv::Mat srcImage2 = cv::imread("img2.png", 1);
	if (!srcImage1.data || !srcImage2.data) {
		std::cout << "No images" << std::endl;
	}
	int minHessian = 400;
	cv::Ptr<cv::xfeatures2d::SurfFeatureDetector> detector = cv::xfeatures2d::SurfFeatureDetector::create(minHessian);
	
	//keypoint存储着特征点像素的坐标
	std::vector<cv::KeyPoint> keypoint1, keypoint2;
	cv::Mat dstImage1, dstImage2;
	//特征点检测,并计算特征点的特征向量
	detector->detect(srcImage1, keypoint1);
	detector->detect(srcImage2, keypoint2);
	detector-&
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值