I am using OpenCV in Python to make a feature descriptor of a give image. For that I am using ORB
class.What I don't understand is what the descriptor array contains after using orb.detect
and orb.compute
methods.
Below is my code.
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]
The output of the last line is below:
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]
Why is the length of each element of des
is 32? What does it represent? I know that it is supposed to be a descriptor array corresponding to each keypoint, but what exactly do those numbers represent?
I have tried the above code from this link.
The default lenght of each ORB descriptor is 32 bytes. Each byte contains 8 pixel intensity comparisons as explained in the official paper: https://www.willowgarage.com/sites/default/files/orb_final.pdf
Also check: OpenCV ORB descriptor - how exactly is it stored in a set of bytes?