opencv/modules/calib3d/test
chengolivia 250b5003ee
Merge pull request #27305 from chengolivia:add-check-sgbm-nondeterminism
Add image dimension check to avoid StereoSGBM non-determinism #27305 
 
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 `compute` method 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

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2025-05-17 10:19:09 +03:00
..
opencl ts: refactor OpenCV tests 2018-02-03 19:39:47 +00:00
test_affine2d_estimator.cpp Add missing std namespace qualifiers 2023-09-06 13:46:39 +03:00
test_affine3.cpp Merge pull request #12437 from vpisarev:avx2_fixes 2018-09-06 18:56:55 +03:00
test_affine3d_estimator.cpp Add missing std namespace qualifiers 2023-09-06 13:46:39 +03:00
test_affine_partial2d_estimator.cpp Add missing std namespace qualifiers 2023-09-06 13:46:39 +03:00
test_calibration_hand_eye.cpp Merge pull request #24897 from JStech:fix-handeye 2024-05-25 11:28:13 +03:00
test_cameracalibration_artificial.cpp Fix some typos 2019-06-05 12:24:13 +02:00
test_cameracalibration_badarg.cpp Remove useless C headers 2025-01-13 16:34:28 +01:00
test_cameracalibration_tilt.cpp Misc. modules/ typos (cont.) 2018-02-12 10:15:36 -05:00
test_cameracalibration.cpp Remove useless C headers 2025-01-13 16:34:28 +01:00
test_chessboardgenerator.cpp code clean up 2019-01-14 22:21:21 +03:00
test_chessboardgenerator.hpp ts: refactor OpenCV tests 2018-02-03 19:39:47 +00:00
test_chesscorners_badarg.cpp Remove useless C headers 2025-01-13 16:34:28 +01:00
test_chesscorners_timing.cpp Fix time measurement in test Calib3d_ChessboardDetector.timing 2023-11-27 23:44:24 +03:00
test_chesscorners.cpp fix bug different marker ordering with findChessboardCornersSBWithMeta and CALIB_CB_LARGER flag 2025-01-27 11:10:26 +01:00
test_compose_rt.cpp ts: refactor OpenCV tests 2018-02-03 19:39:47 +00:00
test_cornerssubpix.cpp ts: cvtest::debugLevel / --test_debug=<N> option 2020-11-28 13:13:28 +00:00
test_decompose_projection.cpp Merge pull request #25182 from MaximSmolskiy:increase-decomposeProjectionMatrix-precision-for-small-scales 2024-03-27 12:43:56 +03:00
test_filter_homography_decomp.cpp Filter homography decomp: updated PR #7153 (#11846) 2018-06-27 16:47:35 +03:00
test_fisheye.cpp Merge pull request #26669 from GouMinghao:4.x 2025-01-24 14:51:10 +03:00
test_fundam.cpp Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-12-03 12:32:49 +00:00
test_homography_decomp.cpp Merge pull request #13601 from JimZhou-001:JimZhou-001 2019-01-11 16:58:47 +03:00
test_homography.cpp Merge pull request #25665 from vrabaud:jacobian 2024-05-31 20:51:58 +03:00
test_main.cpp Merge pull request #11897 from Jakub-Golinowski:hpx_backend 2018-08-31 16:23:26 +03:00
test_modelest.cpp War on Whitespace, master edition: file endings. 2013-08-27 14:23:26 +04:00
test_posit.cpp mostly removed obsolete C API from calib3d (at least at the interface level) (#13081) 2018-11-09 16:12:22 +03:00
test_precomp.hpp ts: refactor OpenCV tests 2018-02-03 19:39:47 +00:00
test_reproject_image_to_3d.cpp mostly removed obsolete C API from calib3d (at least at the interface level) (#13081) 2018-11-09 16:12:22 +03:00
test_solvepnp_ransac.cpp Merge pull request #27185 from MaximSmolskiy:specify_dls_and_upnp_mappings_to_epnp_in_all_places_for_solvepnp_tests 2025-04-02 21:21:56 +03:00
test_stereomatching.cpp Merge pull request #27305 from chengolivia:add-check-sgbm-nondeterminism 2025-05-17 10:19:09 +03:00
test_translation3d_estimator.cpp Add missing std namespace qualifiers 2023-09-06 13:46:39 +03:00
test_undistort_badarg.cpp Partially back-port #25075 to 4.x 2024-03-05 12:15:39 +03:00
test_undistort_points.cpp Merge pull request #21931 from victor1234:calib3d-add-undistortImagePoints 2022-05-12 08:56:58 +00:00
test_undistort.cpp Merge remote-tracking branch 'origin/3.4' into merge-3.4 2023-04-21 10:55:04 +03:00
test_usac.cpp Merge pull request #23078 from ivashmak:update_vsac 2023-06-16 10:59:13 +03:00