Disparity difference between BM and BM_GPU

asked 2015-06-30 11:49:04 -0600

Rakma gravatar image

Dear all,

I am new in OpenCV, and I am testing most of the provided samples to see how they work. I have OpenCV 2.4.11, running on a Ubuntu x86_64 PC, powered with a small GeForce GT 720.

In this context, I have tested the provided cpp stereo matching codes, especially the BM algo : CPU and GPU. I have tested the codes with the provided pictures : it works perfectly using the CPU, but not really using the GPU code (almost black). This is the same for all pictures provided in the OpenCV package...

provided BM code on CPU provided BM code on CPU

provided BM code on GPU provided GPU BM code on GPU

My question is : Is it normal ? Or I have to tune some things in the provided code/pictures

Thanks in advance for your answers.

Best Regards,


edit retag flag offensive close merge delete


My first guess is that the scaling of the visualised picture is incorrect for the imshow function... however the problem could lie deeper. Can you link the sample code you are running?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-07-01 08:14:48 -0600 )edit

I think you need to normalize the disp (type 16S) variable after computing the BM method. Using some like this:

bm_gpu->compute(d_imageL, d_imageR, d_disp);


normalize(disp, disp8U, 0, 255, CV_MINMAX,CV_8U);

Nícolas dos Santos Rosa gravatar imageNícolas dos Santos Rosa ( 2016-03-14 12:56:13 -0600 )edit