我在 Python 中使用 OpenCV 来制作给定图像的特征描述符。为此,我正在使用 ORB
类。我不明白的是在使用 orb.detect
和 orb.compute
之后描述符数组包含什么方法。
下面是我的代码。
import cv2
from matplotlib import pyplot as plt
from sklearn.cluster import KMeans
img = cv2.imread('penguins.jpg',0)
# Initiate STAR detector
orb = cv2.ORB_create(nfeatures=1000)
# 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,des, color=(0,255,0), flags=0, )
plt.imshow(img2),plt.show()
print len(kp),len(des),len(des[1]), des[0]
最后一行的输出如下:
1000 1000 32 [221 65 79 237 6 2 111 112 116 194 243 70 83 99 177 113 118 228
62 238 233 181 37 76 244 171 230 128 45 178 96 49]
为什么des
的每个元素的长度都是32?它代表什么?我知道它应该是每个关键点对应的描述符数组,但这些数字到底代表什么?
我已经从这个 link 中尝试了上面的代码.
最佳答案
默认每个 ORB 描述符的长度为 32 字节。每个字节包含 8 个像素强度比较,如官方论文中所述:https://www.willowgarage.com/sites/default/files/orb_final.pdf
同时检查:OpenCV ORB descriptor - how exactly is it stored in a set of bytes?
关于python - 使用类 ORB 的计算方法生成的描述符数组表示什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30801973/