【图像处理】(特征检测与匹配)ORB算法OpenCV实现

ORB:Oriented FAST and Rotated BRIFE

ORB是一种快速特征点提取和描述的算法

ORB采用FAST检测特征点,这个定义基于特征点周围的图像灰度值,检测候选特征点周围一圈的像素值,如果候选点周围领域内有足够多的像素点与该候选点的灰度值差别够大,则认为该候选点为一个特征点。

FAST算法改进:由于FAST算法提取的点不具有尺度不变性,则是图像的尺度金字塔,将原图像按比例因子S缩小成K(金字塔层数)副图像,然后提取所有图像的特征点总和作为这幅图像的oFAST特征点,使用BRIEF去描述oFAST特征点

代码:

#include<opencv2/opencv.hpp>
#include<opencv2/features2d/features2d.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/nonfree/features2d.hpp>
#include<iostream>
#include<vector>

using namespace std;
using namespace cv;

int main()
{
	Mat Image_1 = imread("2.jpg", 1);
	Mat Image_2 = imread("3.jpg", 1);

	vector<KeyPoint> keypoints_1,keypoints_2;
	ORB orb;
	orb.detect(Image_1, keypoints_1);
	orb.detect(Image_2, keypoints_2);

	Mat descriptors_1,descriptors_2;
	orb.compute(Image_1, keypoints_1, descriptors_1);
	orb.compute(Image_2, keypoints_2, descriptors_2);

	BFMatcher matcher(NORM_HAMMING);
	vector<DMatch> matches;
	matcher.match(descriptors_1, descriptors_2,matches);

	Mat dst;
	drawMatches(Image_1, keypoints_1, Image_2, keypoints_2, matches,dst);
	imshow("效果图",dst);
	waitKey(0);
	return 0;
}

效果图:

一级棒!! 

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值