-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Bug in stereo_match.cpp #15779
Copy link
Copy link
Closed
Milestone
Description
System information (version)
- OpenCV => ❔
- Operating System / Platform => ❔
- Compiler => ❔
Detailed description
The stereo_match.cpp code (https://github.com/opencv/opencv/blob/master/samples/cpp/stereo_match.cpp) has a scaling issue that took me 2 days to track down. The computed disparity is a signed int16, and is scaled by a factor of 16 compared to the true disparity, as per the documentation. The disparity thus must be converted to float and divided by 16.0 before invoking reprojectImageTo3D(). As it is now, since this division is not done, the result of reprojectImageTo3D() is wrong, as is at 1/16-the the scale.
Suggested fix:
Mat float_disp;
disp.convertTo(float_disp, CV_32F, 1.0f/16.0f);
reprojectImageTo3D(float_disp, xyz, Q, true);
Steps to reproduce
Reactions are currently unavailable