OpenCV - ORB算法(Python实现)

原理

ORB(Oriented FAST and Rotated BRIEF)是一种快速特征点提取和描述的算法,这个算法是由Ethan Rublee, Vincent Rabaud, Kurt Konolige以及Gary R.Bradski在2011年一篇名为“ORB:An Efficient Alternative to SIFTor SURF”的文章中提出.ORB算法分为两部分,分别是特征点提取和特征点描述。特征提取是由FAST(Features from Accelerated Segment Test)算法发展来的,特征点描述是根据BRIEF(Binary Robust IndependentElementary Features)特征描述算法改进的.

代码

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

img = cv2.imread('image.jpg')

# Initiate ORB detector
orb = cv2.ORB_create()

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

# 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)
cv2.imshow("img",img2)
cv2.waitKey()
cv2.destroyAllWindows()

OpenCV - ORB算法(Python实现)_第1张图片

你可能感兴趣的:(【OpenCV】,OpenCV)