Ask Your Question

Revision history [back]

Findings: StereoBM erroneously truncates the right edge of its output disparity map at at

x = width - max(minDisparities, 0) - SADWindowSize / 2

when it ought to be valid as far out as

x = width - SADWindowSize / 2

This has been demonstrated in examples above, and by modifying samples/stereo_match.cpp to set minDisparities > 0.

In contrast, the StereoSGBM algorithm works correctly.

The modification proposed above, to getValidDisparityROI from modules/calib3d/src/stereosgbm.cpp, will calculate a StereoBM disparity map with a correct right margin.

Update: This issue is fixed in opencv master as of 3.3.1, and the 2.4 version following 2.4.13.4.

Findings: StereoBM erroneously truncates the right edge of its output disparity map at at

x = width - max(minDisparities, 0) - SADWindowSize / 2

when it ought to be valid as far out as

x = width - SADWindowSize / 2

This has been demonstrated in examples above, and by modifying samples/stereo_match.cpp to set minDisparities > 0.

In contrast, the StereoSGBM algorithm works correctly.

The modification proposed above, to getValidDisparityROI from modules/calib3d/src/stereosgbm.cpp, will calculate a StereoBM disparity map with a correct right margin.