OpenCV Big difference between StereoSGBM and gpu::StereoBM_GPU

Deadly 提交于 2019-12-23 01:13:23

问题


I try to generate disparity of stereo image by using OpenCV and optimize performance by using GPU but the results of them are different.

StereoSGBM initialize

StereoSGBM sbm;
sbm.SADWindowSize = 3;
sbm.numberOfDisparities = 144;
sbm.preFilterCap = 63;
sbm.minDisparity = -39;
sbm.uniquenessRatio = 10;
sbm.speckleWindowSize = 100;
sbm.speckleRange = 32;
sbm.disp12MaxDiff = 1;
sbm.fullDP = false;
sbm.P1 = 216;
sbm.P2 = 864;
sbm(grayLeftCurrentFrameCPU, grayRightCurrentFrameCPU, resultCurrentFrameCPU);
normalize(resultCurrentFrameCPU, resultNorCurrentFrameCPU, 0, 255, CV_MINMAX, CV_8U);

Result: http://i.stack.imgur.com/eov4N.jpg

gpu::StereoBM_GPU initialize

gpu::StereoBM_GPU *bm = new gpu::StereoBM_GPU();
bm->preset = gpu::StereoBM_GPU::BASIC_PRESET;
bm->ndisp = 48;
bm->winSize = 5;
bm->operator()(grayLeftCurrentFrameGPU, grayRightCurrentFrameGPU,       resultCurrentFrameGPU);
gpu::normalize(resultCurrentFrameGPU, resultNorCurrentFrameGPU, 0, 255, CV_MINMAX, CV_8U);

Result: http://i.stack.imgur.com/WVzrK.jpg

Does anyone know why?


回答1:


gpu::StereoBM_GPU is the GPU version of cv::StereoBM (documentation link).

cv::StereoSGBM uses another algorithm (documentation link), hence the different results.

In order to determine why the result of gpu::StereoBM_GPU is wrong, it would be useful to know how you rectified your pair of images.



来源:https://stackoverflow.com/questions/22142554/opencv-big-difference-between-stereosgbm-and-gpustereobm-gpu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!