OpenCV - BRIEF特征描述子(Python实现)

原理

BRIEF:一种对已检测到的特征点进行描述的算法,它是一种二进制编码的描述子,在图像匹配时使用BRIEF能极大的提升匹配速度.

代码

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

img = cv2.imread('image.jpg',0)
# Initiate FAST detector
star = cv2.xfeatures2d.StarDetector_create()

# Initiate BRIEF extractor
brief = cv2.xfeatures2d.BriefDescriptorExtractor_create()

# find the keypoints with STAR
kp = star.detect(img,None)

# compute the descriptors with BRIEF
kp, des = brief.compute(img, kp)

print( brief.descriptorSize() )
print( des.shape)

img1 = cv2.drawKeypoints(img, kp, None, color=(255,0,0))
cv2.imshow('BRIEF',img1)
cv2.waitKey()

OpenCV - BRIEF特征描述子(Python实现)_第1张图片

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