opencv python ORB特征提取

简单的摘抄,说明ORB多么棒。

Theory:
As an OpenCV enthusiast, the most important thing about the ORB is that it came from “OpenCV Labs”. This algorithm was brought up by Ethan Rublee, Vincent Rabaud, Kurt Konolige and Gary R. Bradski in their paper ORB: An efficient alternative to SIFT or SURF in 2011. As the title says, it is a good alternative to SIFT and SURF in computation cost, matching performance and mainly the patents. Yes, SIFT and SURF are patented and you are supposed to pay them for its use. But ORB is not !!!

code:

import numpy as np
import cv2
from matplotlib import pyplot as plt

img = cv2.imread('1.png', 0)
# print('img')

# Initiate STAR detector
orb = cv2.ORB_create()
print('orb')

# find the keypoints with ORB
kp = orb.detect(img, None)
print('kp')

# compute the descriptors with ORB
kp, des = orb.compute(img, kp)

# draw only keypoints location,not size and orientation
img2 = cv2.drawKeypoints(img, kp, None, color=(0, 255, 0), flags=0)
print('img2')

plt.imshow(img2)
plt.show()

  • 名词解释
    训练图像:感兴趣的目标图像
    查询图像:包含有目标的场景图

    识别的过程,就是为了在查询图像中找到训练图像

  • 算法原理
    一. 流程

    1. 利用FAST找到关键点,根据我的理解,这些关键点会关注角点以及边沿等
    2. 使用BRIEF对关键点的邻域特征进行描述,得到每个关键点的二进制编码特征描述
    3. 通过图像金字塔实现特征的尺度不变性;改进BRIEF,也就是rBRIEF实现旋转不变性

    二. 识别过程

    1. 首先对训练图像与查询图像分别计算ORB特征
    2. 使用匹配函数进行匹配。目的是得到关键点之间的对应关系,方法是通过比较各关键点描述符之间的距离来实现。 这里加粗是因为我一开始没看原理,一直没搞明白的一个地方,主要的问题就是没明白描述符表达的物理意义。简单来讲,就是两个关键点的特征越相似,就越容易配对。

参考

OpenCV ORB (Oriented FAST and Rotated BRIEF)

你可能感兴趣的:(opencv,python,计算机视觉)