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!
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.