Ask Your Question

SURF slower than SIFT

asked 2013-01-04 07:32:11 -0500

aliciadominica gravatar image

Hi everyone, I'm testing the performance of opencv feature detection and description algorithms and even though the paper claims otherwise, Surf works slower than Sift by about a milisecond or two. I couldn't make sense of it. I changed the cvRound input to float as suggested here, but it doesn't do anything. My code is below, there are also other detectors and descriptors there and I uncomment whichever I'd like to test, I'd appreciate anyone who can shed light on this, they both match around 600-700 keypoints:

    //OrbFeatureDetector detector(500);
    SurfFeatureDetector detector(1500,4);
    ////cv::FAST(imgB, keypointsB, 20);
    //SiftFeatureDetector detector;

    // DESCRIPTOR ORB, SURF, BRIEF, SIFT. Uncomment these lines if you want to use SURF, ORB, BRIEF or SIFT.
    //OrbDescriptorExtractor extractor;
    SurfDescriptorExtractor extractor;
    //BriefDescriptorExtractor extractor;
    //SiftDescriptorExtractor extractor;

        // detect
    double t11 = (double)getTickCount();
    detector.detect( img1, keypointsB );
    t11 = ((double)getTickCount() - t11)/getTickFrequency();

    double t1 = (double)getTickCount();
    detector.detect( img2, keypointsA );
    t1 = ((double)getTickCount() - t1)/getTickFrequency();

    double t22 = (double)getTickCount();
    extractor.compute( img1, keypointsB, descriptorsB);
    t22 = ((double)getTickCount() - t22)/getTickFrequency();

        // extract
    double t2 = (double)getTickCount();
    extractor.compute( img2, keypointsA, descriptorsA);
    t2 = ((double)getTickCount() - t2)/getTickFrequency();

    // match
    double t3 = (double)getTickCount();
    matcher.match(descriptorsA, descriptorsB, matches);
    t3 = ((double)getTickCount() - t3)/getTickFrequency();
    //std::cout << "matching time [s]: " << t3 << std::endl;
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-01-05 03:59:50 -0500

There are some performance tests on SUFT in OpenCV modules/nonfree/perf/perf_surf.cpp. You can use it as base for performance testing. There are several reasons for such results.

  1. It is more fair to calculate performance per feature or other "size" of the task. It makes your results independent from this "size", i.e. count of found features.

  2. The precision of timers on different platforms is different. There are a lot of things that can add noise to your processing time. The better way for measurement is to run algorithms several time in the loop and divide time on iterations count.

edit flag offensive delete link more


This is part of a longer code and it already runs in the loop, so measuring the time out of the loop would result in measuring the time of the entire code but I'll check if per count measuring gives better results. I already modified the parameters so that SURF and SIFT would detect and extract approximately the same number of features but even a small change in numbers can make a difference in time measurement. Thanks for the input.

Edit: Per feature is still slower.

aliciadominica gravatar imagealiciadominica ( 2013-01-07 01:59:02 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2013-01-04 07:32:11 -0500

Seen: 780 times

Last updated: Jan 05 '13