Ask Your Question

Jeb11's profile - activity

2014-06-11 12:48:43 -0600 received badge  Critic (source)
2014-06-11 11:32:10 -0600 asked a question Performance of OpenCV GPU BruteForceMatcher

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

2014-06-11 05:17:37 -0600 received badge  Student (source)
2014-06-11 03:52:00 -0600 asked a question Understanding OpenCV L2 metric

Hello,

I'm trying to code opencv-like bruteforcematcher by calculating the euclidean distance between 2 SIFT descriptor vectors.

The problem is when using

BruteForceMatcher< l2 < float> > matcher;

the metric appears to be totally different from the euclidean distance I've just calculated.

Is there any documentation that explains why this is the case? I googled it, but haven't found a decent explanation.

Thank you

2014-04-02 05:14:35 -0600 received badge  Editor (source)
2014-04-02 05:14:00 -0600 answered a question i have problem with imshow 2.4.8 64bit

try :

void openImage(Mat& img)
2014-04-02 04:38:06 -0600 asked a question Shifted frame in video output (videowriter function)

I'm trying to write a video using opencv's VideoWriter function. Here's my code:

VideoWriter out_capture("video.avi",CV_FOURCC('M','J','P','G'), 30, RESULTS[0].size() ,true);

 for(int i = 0 ; i < RESULTS.size() ; i++)
{
Mat img;
RESULTS[i].copyTo(img);

if(img.empty())
    break;
out_capture << img;
}

RESULTS is a vector storing all my images.

Here is a frame of the video:

frame

And thats how my original images look: original images

I've finally found the solution: With the code below, it's working perfectly now!

IplImage* img = cvLoadImage("path_to_images 0 .jpg");
char filename[100];
int i = 0;

CvVideoWriter *writer = cvCreateVideoWriter("video.avi",
        CV_FOURCC('M', 'J', 'P', 'G'), 10 , RESULTS[0].size() ,  true);

for ( int iter = 0 ; iter < RESULTS.size() ; iter++)
{
    sprintf( filename, "path_to_images/image %d .jpg", i );
    img = cvLoadImage(filename);
    cvWriteFrame(writer,img);
    i++;
}
cvReleaseVideoWriter(&writer);
cvReleaseImage(&img);