OpenCV4入门教程117:Brisk特征提取与描述子匹配

索引地址:系列索引

特征:图像特征与特征描述子

BRISK特征提取描述算法全称为 Binary Robust Invariant Scalable Keypoints(二进制鲁棒不变可扩展关键点)。BRISK算法也是SIFT算法的一种改进型,主要是针对于旋转不变性、鲁棒性、运算速度等方面做了优化,其大致流程如下:

(1)在提取特征点阶段与SIFT算法类似,同样是先构造多尺度图像金字塔,再从每一层图像组的多尺度空间中找到最大特征点(非极大值抑制);

(2)再通过亚像素插值得到最大特征点的精确坐标位置,也即把最大特征点从其它层的坐标映射到金字塔最底层的坐标位置,从而完成对最大特征点的定位。

(3)在描述特征点阶段,使用特征点邻域同心圆采样法,在每个特征点的邻域中选择一个同心圆,在这个同心圆上均匀采样,并对所有采样点进行高斯模糊以消除重复采样带来的影响,并以采样点中的短距离点对的灰度值比较结果,来构建二进制描述子。

(4)再以每个特征点的方向特征、也就是梯度来进行方向归一化,强化了BRISK特征描述子的旋转不变性。

特征步骤

  • 构建尺度空间
  • 特征点检测
  • FAST9-16寻找特征点
  • 特征点定位
  • 关键点描述子

BRISK是BRIEF描述子的一种改进,相比于BRIEF特征,它具有旋转不变性、尺度不变性和对噪声的鲁棒性。几个特征检测的速度比较:SIFT>SURF>BRISK>FREAK>ORB,在对有较大模糊的图像配准时,BRISK算法在其中表现最为出色。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <opencv2/core/core.hpp> 
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/xfeatures2d.hpp>

using namespace cv;

int main(int argc, char** argv)
{
Mat img_1 = imread("box.png");
Mat img_2 = imread("box_in_scene.png");

// -- Step 1: Detect the keypoints using STAR Detector
std::vector<KeyPoint> keypoints_1,keypoints_2;
Ptr<xfeatures2d::StarDetector> detector =xfeatures2d::StarDetector::create();
detector->detect(img_1, keypoints_1);
detector->detect(img_2, keypoints_2);

// -- Stpe 2: Calculate descriptors (feature vectors)
Ptr<BRISK> brisk=BRISK::create();
Mat descriptors_1, descriptors_2;
brisk->compute(img_1, keypoints_1, descriptors_1);
brisk->compute(img_2, keypoints_2, descriptors_2);

//-- Step 3: Matching descriptor vectors with a brute force matcher
BFMatcher matcher(NORM_HAMMING);
std::vector<DMatch> mathces;
matcher.match(descriptors_1, descriptors_2, mathces);
// -- dwaw matches
Mat img_mathes;
drawMatches(img_1, keypoints_1, img_2, keypoints_2, mathces, img_mathes);
// -- show
imshow("Mathces", img_mathes);

waitKey(0);
return 0;
}

效果为

brisk


OpenCV4入门教程117:Brisk特征提取与描述子匹配
https://feater.top/opencv/opencv-brisk-feature-detect-and-descriptor-match/
作者
JackeyLea
发布于
2020年10月6日
许可协议