FREAK feature extraction OpenCV

I want to know how to use FREAK feature extraction in python, I read the documentation but I need some examples. I wrote this code :

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


but the descriptor are None, why?

I used keypoints detected by SURF instead of None parameter:

surfDetector = cv2.xfeatures2d.SURF_create()
keypoints = surfDetector.detect(image,None)
freakExtractor = cv2.xfeatures2d.FREAK_create()
keypoints,descriptors= freakExtractor.compute(image,keypoints)


but the output was very very large, and hard to process. How can I fix this? Thanks...

FREAK is only a feature descriptor, so in order to use it you must provide a set of keypoints for it to extract your features e.g., FAST, AGAST, SIFT’s keypoint detector, etc. The original paper uses AGAST.

You might need to process the keypoints since the region requirements are different (A keypoint for SURF might lay too close on the border to compute FREAK).

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


The FREAK: Fast Retina Keypoint paper says:

Rostenand and Drummond proposed in [A] the FAST criterion for corner detection, improved by Mair et al. in [B] with their AGAST detector. The latter is a fast algorithm to locate keypoints. The detector used in BRISK by Leutenegger et al. in [C] is a multi-scale AGAST. They search for maxima in scale-space using the FAST score as a measure of saliency. We use the same detector for our evaluation of FREAK.

• [A] E. Rosten and T. Drummond. Machine learning for highspeed corner detection. Computer Vision–ECCV 2006, pages 430–443, 2006.
• [B] E. Mair, G. Hager, D. Burschka, M. Suppa, and G. Hirzinger. Adaptive and generic corner detection based on the accelerated segment test. Computer Vision–ECCV 2010, pages 183–196, 2010. 2
• [C] S. Leutenegger, M. Chli, and R. Siegwart. Brisk: Binary robust invariant scalable keypoints. 2011.

Sources: Here and This SO question

• OBS: Surf/SIFT and other patented feature detector were removed from OpenCV main build. – Pedro Henrique Monforte Aug 29 '20 at 10:57