pythonfeature-detectionopencvfeature-descriptor

Zero keypoints detected with BRIEF, BRISK, AKAZE and FREAK


I am trying to do Feature Detection and Description with the BRIEF, BRISK, AKAZE and FREAK Binary Descriptors.

I'm doing a test with a 28x28 image of the MINIST visual dataset, as can be seen below:

enter image description here

I called all methods the following way:

FAST:

FAST = cv.FastFeatureDetector_create(threshold = 80,
                                     nonmaxSuppression = True)

BRIEF:

BRIEF = cv.xfeatures2d.BriefDescriptorExtractor_create(bytes = 16,
                                                       use_orientation = False)

BRISK:

BRISK = cv.BRISK_create(thresh = 30,
                        octaves = 0,
                        patternScale = 1.0)

AKAZE:

AKAZE = cv.AKAZE_create(descriptor_type = cv.AKAZE_DESCRIPTOR_MLDB,
                        descriptor_size = 0,
                        descriptor_channels = 3,
                        threshold = 0.001,
                        nOctaves = 4,
                        nOctaveLayers = 4,
                        diffusivity = cv.KAZE_DIFF_PM_G2)

FREAK:

FREAK = cv.xfeatures2d.FREAK_create(orientationNormalized = True,
                                    scaleNormalized = True,
                                    patternScale = 22.0,
                                    nOctaves = 4)

NOTE 1: I used the Descriptors BRIEF and FREAK with the FAST Detector.

I finded the Keypoints and compute the Descriptors, as bellow:

keypoints = FAST.detect(image, None)
keypoints, descriptors = BRIEF.compute(image, keypoints)

Note that in this example I'm trying to find the Keyponts and compute the BRIEF Descriptors, but for ALL the Descriptors described above, I get the following output:

print("Keyponts:", keypoints, "\n")

print("Descriptors:", descriptors, "\n")

Keyponts: [] 

Descriptors: None 

NOTE 2: I used the same parameters presented with any other 640x546 size image and I was able to find Keypoints and compute the Descriptors. The problem is that I'm doing a search where I'll need to use the MINIST visual dataset.

NOTE 3: With other Descriptors such as SIFT, SURF, KAZE and ORB I was able to find Keyponts and compute Descriptors for that same visual dataset.

I have changed the parameters of ALL the Descriptors several times, but unfortunately I can't find Keypoints and compute Descriptors with them in the visual dataset MNIST. I would like to know if there is a right way to choose these parameters or if there is something I can do.

I believe there is a problem in finding Keypoints and computer Descriptors with these Descriptors in small images (?) of size 28x28 (?).

I'm using Python 3.6 and OpenCV 4.1 (with opencv_contrib modules).


Solution

  • Cause:

    MNIST images are 28x28 pixels, as described in the question.

    To find keypoints and compute descriptors, remarkable descriptors like SIFT and SURF can obtain great results in tinier patches, still, many descriptors (e.g. ORB) obtain great results in a 32x32 patch.

    It was not possible to obtain results on MNIST using the descriptors BRIEF, BRISK, AKAZE, and FREAK, since MNIST has small images.

    Solution:

    To avoid the return of keypoints without descriptors, BRIEF, BRISK, AKAZE, and FREAK remove the keypoints. With this, it is possible to observe that these descriptors do not fit properly in images present in the MNIST dataset.

    Other Tests:

    However, with the descriptors BRIEF, BRISK, AKAZE, and FREAK, it was possible to obtain results (using the same parameters presented in the question) with any other image that has grander patches (In this experiment 640x546 patch).

    BRIEF:

    enter image description here

    BRISK:

    enter image description here

    AKAZE:

    enter image description here

    FREAK:

    enter image description here

    With this, it is possible to observe that the image with a size of 640x546 pixels has somewhat more significant features.

    I hope this answer helps others who have this same question.

    To learn more about Detection and Description techniques, I recommend the following repository on GitHub: