StereoBinaryBM crashes [closed]

asked 2017-04-25 22:38:56 -0600

Nbb gravatar image

updated 2017-04-26 03:35:04 -0600

I am trying to compute the disparity map for my stereo pair but the program keeps crashing when I create the stereo matching object. It crashes at this line

 auto sbm = cv::stereo::StereoBinaryBM::create(0, 9);

with this error.

OpenCV Error: Assertion failed (val > 10) in cv::stereo::Matching::setMaxDisparity, file C:\ProgramFiles\Bin\opencv_contrib-master\modules\stereo\include\opencv2/stereo/matching.hpp, line 379

This code I have works fine though

    auto sgbm = cv::stereo::StereoBinarySGBM::create(
        -64,   //min disparity          
        192,   //num disparities
        5,     //block size         
        600,   //P1
        2400,  //P2
        10,    //disparity max difference
        4,     //pre-filter cap
        1,     //uniqueness ratio
        150,   //speckle window size
        2,     //speckle range
        cv::StereoSGBM::MODE_SGBM);

EDIT: It works now when I use

auto sbm = cv::stereo::StereoBinaryBM::create(64, 9);

but now it crashes at sbm->compute(im_00, im_01, disparity); without mentioning any error.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by berak
close date 2017-04-26 03:36:44.945639

Comments

1

why are you trying to create a StereoBinaryBM with 0 disparities ?

berak gravatar imageberak ( 2017-04-26 00:27:55 -0600 )edit