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

ORB:Oriented FAST and Rotated BRIFE

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

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

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

代码:

#include
#include
#include
#include
#include
#include

using namespace std;
using namespace cv;

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

	vector 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 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;
}

效果图:

一级棒!! 

你可能感兴趣的:(图像处理)