Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FREAK Descriptor with Opencv Python

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!

like image 791
Colenso Castellino Avatar asked Jan 29 '13 17:01

Colenso Castellino


1 Answers

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.

like image 76
Jav_Rock Avatar answered Sep 29 '22 19:09

Jav_Rock