androidopencvsiftsurf

SURF description faster with FAST detection?


for my master thesis, i am running some test on the SIFT SURF en FAST algoritms for logo detection on smartphones.

when i simply time the detection, description en matching for some methods i get the following results.

For a SURF detector and SURF descriptor:

180 keypoints found

when I use a FAST detector in stead of the SURF detector

319 keypoints found

The FAST detector is much faster than the SURF detector, and even detects almost twice as many keypoints 100 times faster. These results are predictable.

The next step though is not a predicted result. How is it possible that de SURF descriptor is faster with the 319 FAST keypoints then with the 180 SURF keypoints?

From what I know, the description has no relation with the detection algorithm... yet these results are not as predicted.

does any one know how this is possible?

here is the code:

    FeatureDetector detector = FeatureDetector.create(FeatureDetector.SURF);
    //FeatureDetector detector = FeatureDetector.create(FeatureDetector.FAST);
    Imgproc.cvtColor(image1, image1, Imgproc.COLOR_RGBA2RGB);
    Imgproc.cvtColor(image2, image2, Imgproc.COLOR_RGBA2RGB);

    DescriptorExtractor SurfExtractor = DescriptorExtractor
    .create(DescriptorExtractor.SURF);


    //extract keypoints
    long time= System.currentTimeMillis();
    detector.detect(image1, keypoints);
    Log.d("LOG!", "number of query Keypoints= " + keypoints.size());
    detector.detect(image2, logoKeypoints);
    Log.d("LOG!", "number of logo Keypoints= " + logoKeypoints.size());
    Log.d("LOG!", "keypoint calculation time elapsed" + (System.currentTimeMillis() -time));

    //Descript keypoints
    long time2 = System.currentTimeMillis();
    Mat descriptors = new Mat();
    Mat logoDescriptors = new Mat();
    Log.d("LOG!", "logo type" + image2.type() + "  intype" + image1.type());
    SurfExtractor.compute(image1, keypoints, descriptors);
    SurfExtractor.compute(image2, logoKeypoints, logoDescriptors);
    Log.d("LOG!", "Description time elapsed" + (System.currentTimeMillis()- time2));

Solution

  • AFAIK the most time consuming part of SURF descriptor extraction is subpixel extraction of patch having (2.8*keypoint.size x 2.8*keypoint.size) size around the every keypoint.

    So here is my guess: keypoints found by FAST detector always have their size equal to 7 but SURF detector can find keypoints of much bigger size. So 180 "big" keypoints are processed longer than 319 "small".