FREAK Descriptor with Opencv Python
Asked Answered
W

2

15

I was trying to implement the FREAK Descriptor in Python using Opencv. Here is the code i'm using:

def surf_freak_detect(image,hessianThreshold):
    surfDetector = cv2.SURF(hessianThreshold)
    surfDetector=cv2.GridAdaptedFeatureDetector(surfDetector,50)
    keypoints = surfDetector.detect(image,None) 
    freakExtractor = cv2.DescriptorExtractor_create('FREAK')
    keypoints,descriptors= freakExtractor.compute(image,keypoints)
    del freakExtractor
    return keypoints,descriptors

Is this the correct way to initialise the Freak Descriptor? By doing a little debugging I found out that the interpreter takes a very long time at Computing the Descriptors and then eventually crashes. The keypoints are detected properly. Weirdly, it works sometimes and sometimes just crashes!

Withy answered 29/1, 2013 at 17:28 Comment(2)
Did you ever get anywhere with this?Invalidate
Actually no. I ended up using SURF. It appears that the OpenCV Python version I was using didn't implement wrappers for the FREAK Descriptor. If you still need to use it, you can use it's through the native C++ implementation.Withy
K
11

If the keypoints are detected properly but the program crashes when generating the descriptors it is because the descriptor region (which surrounds the keypoint) comes out of the image and there is a memory access to a position that does not exist.

You have to somehow limit the operating region for freak descriptors.

Karilynn answered 17/12, 2013 at 10:47 Comment(0)
P
9

There are now Python bindings for FREAK in OpenCV 3.0. Its configuration options are described here. It seems to be missing documentation of how to actually call it in Python, but you can use it in Python like this:

freakExtractor = cv2.xfeatures2d.FREAK_create()
keypoints,descriptors= freakExtractor.compute(image,keypoints)

(You have to get the keypoints from a separate feature detector, like you did in your code above.)

Pistol answered 20/11, 2015 at 3:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.