Performance of OpenCV GPU BruteForceMatcher

asked 2014-06-11 11:32:10 -0600

Jeb11 gravatar image

Hello,

I'm trying to accelerate the OpenCV CPU BruteForce Matcher by using its GPU version. Here is my code:

// OpenCV CPU BruteForceMatcher
timer.start();
    vector < vector<DMatch> > cpu_matches;
    Ptr<DescriptorMatcher> cpu_matcher = DescriptorMatcher::create("BruteForce");
    cpu_matcher->knnMatch(descriptors_img , descriptors_fond , cpu_matches , 2);
timer.stop();
cout << "OpenCV CPU MATCHING TIME : " << timer.ellapsedTime() << " ms." << endl;

// OpenCV GPU BruteForceMatcher
timer.start();
    GpuMat gpu_descriptors_img (descriptors_img) , gpu_descriptors_fond (descriptors_fond);
    vector < vector<DMatch> > gpu_matches;
    BruteForceMatcher_GPU_base gpu_matcher;
    gpu_matcher.knnMatch(gpu_descriptors_img , gpu_descriptors_fond , gpu_matches , 2);
timer.stop();
cout << "OpenCV GPU MATHING TIME : " << timer.ellapsedTime() << " ms." << endl;

The problem is that the GPU matcher is always slower than the cpu one. Can anyone can explain me why? thank you.

Set up: I'm Using CUDA 5.0 with GeForce GTX 650 (compute capability 3.0) , Ubuntu 14.04 LTS

edit retag flag offensive close merge delete

Comments

are you using OpenCV with IPP or without IPP? IPP uses GPU internally! If not, try measuring without the overhead of loading images from/to gpu. and call the gpu function once before time measurement (first call might be slow).

Micka gravatar imageMicka ( 2015-03-25 11:17:00 -0600 )edit