diff --git a/modules/calib3d/test/test_cameracalibration.cpp b/modules/calib3d/test/test_cameracalibration.cpp index 52bb59d685..bf48675965 100644 --- a/modules/calib3d/test/test_cameracalibration.cpp +++ b/modules/calib3d/test/test_cameracalibration.cpp @@ -2118,6 +2118,44 @@ TEST(Calib3d_StereoCalibrate_CPP, extended) EXPECT_TRUE(err.total() == 2); } +TEST(Calib3d_StereoCalibrate, regression_10791) +{ + const Matx33d M1( + 853.1387981631528, 0, 704.154907802121, + 0, 853.6445089162528, 520.3600712930319, + 0, 0, 1 + ); + const Matx33d M2( + 848.6090216909176, 0, 701.6162856852185, + 0, 849.7040162357157, 509.1864036137, + 0, 0, 1 + ); + const Matx D1(-6.463598629567206, 79.00104930508179, -0.0001006144444464403, -0.0005437499822299972, + 12.56900616588467, -6.056719942752855, 76.3842481414836, 45.57460250612659, + 0, 0, 0, 0, 0, 0); + const Matx D2(0.6123436439798265, -0.4671756923224087, -0.0001261947899033442, -0.000597334584036978, + -0.05660119809538371, 1.037075740629769, -0.3076042835831711, -0.2502169324283623, + 0, 0, 0, 0, 0, 0); + + const Matx33d R( + 0.9999926627018476, -0.0001095586963765905, 0.003829169539302921, + 0.0001021735876758584, 0.9999981346680941, 0.0019287874145156, + -0.003829373712065528, -0.001928382022437616, 0.9999908085776333 + ); + const Matx31d T(-58.9161771697128, -0.01581306249996402, -0.8492960216760961); + + const Size imageSize(1280, 960); + + Mat R1, R2, P1, P2, Q; + Rect roi1, roi2; + stereoRectify(M1, D1, M2, D2, imageSize, R, T, + R1, R2, P1, P2, Q, + CALIB_ZERO_DISPARITY, 1, imageSize, &roi1, &roi2); + + EXPECT_GE(roi1.area(), 400*300) << roi1; + EXPECT_GE(roi2.area(), 400*300) << roi2; +} + TEST(Calib3d_Triangulate, accuracy) { // the testcase from http://code.opencv.org/issues/4334