5

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.

dc95
  • 1,319
  • 1
  • 22
  • 44
  • I think you can look at the question(https://stackoverflow.com/questions/23676365/opencv-orb-descriptor-how-exactly-is-it-stored-in-a-set-of-bytes), maybe you can help you – rainy Jul 07 '17 at 07:27

1 Answers1

2

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?

Community
  • 1
  • 1
zedv
  • 1,459
  • 12
  • 23
  • 1
    Could you elaborate more on what you mean by 8 pixel intensity comparisons? I am finding the paper hard to read. Thanks. – dc95 Jun 15 '15 at 17:41