Add image dimension check to avoid StereoSGBM non-determinism#27305
Add image dimension check to avoid StereoSGBM non-determinism#27305asmorkalov merged 3 commits intoopencv:4.xfrom
Conversation
|
I see in the build failure that test_videoio failed for precommit_linux64_no_opt. However, when I click "test summary" for test_videoio, I see: In the stdio log, the exceptions I see are related to not being able to open files or devices, e.g.: This appears to be unrelated to my changes, which are only within calib3d. |
|
The non-default failing checks from the previous run are:
I do not see any tests failing in the job, but it is stuck on:
I also do not see any tests failing in the job, but it is stuck on:
None of these failures seem to be related to my change in StereoSGBM in calib3d. @asmorkalov Would you be able to restart the failing jobs or approve the PR despite them? This is my first contribution, so apologies if I missed something. |
|
All the checks besides default are passing now. @asmorkalov Would you be able to restart the default check? Thanks! |
Addresses #25828
Users noticed that StereoSGBM would occasionally give non-deterministic results for
.compute(imgL, imgR).I and others traced the cause to out-of-bounds access that was not being caught when the input images were not wide enough for the input block size and number of disparities to StereoSGBM. The specific math and logic can be found in the above issue's discussion.
This PR adds a CV_Check to make sure images are wider than 1/2 of the block size + the max disparity the algorithm will search.
The check was only added to the regular
computemethod for StereoSGBM and not to the other modes, as I did not observe the non-deterministic behavior with the other compute modes like HH.In addition, this PR adds a test case to Calib3d to make sure the check is being thrown in the problem case and that the results are deterministic in the good case.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.