0

I'm using OpenCV 2.4 to extract SURF features and need the laplacian value of each keypoint for the matching process.

I didn't have a problem with this when I was using OpenCV 2.3. In OpenCV 2.4 cv2.SURF() doesn't work so I have to resort to doing this:

im2 = cv2.imread(imgPath)
im = cv2.cvtColor(im2, cv2.COLOR_BGR2GRAY)
surfDetector = cv2.FeatureDetector_create("SURF")
surfDescriptorExtractor = cv2.DescriptorExtractor_create("SURF")
keypoints = surfDetector.detect(im)
(keypoints, descriptors) = surfDescriptorExtractor.compute(im,keypoints)

This works, however it gives me a set of general keypoint objects. Is there a way to get the SURF specific values? (laplacian, hessian)

Unfortunately I can't go back to 2.3 since 2.4 fixes another issue I had previously.

Kkov
  • 1,472
  • 2
  • 11
  • 20

1 Answers1

3

Assuming keypoint to be a single keypoint:

x = keypoint.pt[0]
y = keypoint.pt[1]
size = keypoint.size
dir_in_degrees = keypoint.angle
laplacian = round(keypoint.class_id)
hessian = keypoint.response
Andrey Kamaev
  • 29,582
  • 6
  • 94
  • 88
  • Thank you! Exactly what I wanted. However I think the `round` should be around the hessian not the laplacian. – Kkov May 30 '12 at 22:29