From 56ed8b172137cd737c393cd0d5978922c822a310 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 15 Nov 2016 22:25:42 +0300 Subject: [PATCH] calib3d: fix fisheye for test fisheyeTest.stereoCalibrateFixIntrinsic --- modules/calib3d/src/fisheye.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/calib3d/src/fisheye.cpp b/modules/calib3d/src/fisheye.cpp index 9882cd8792..a2f117b028 100644 --- a/modules/calib3d/src/fisheye.cpp +++ b/modules/calib3d/src/fisheye.cpp @@ -1028,8 +1028,10 @@ double cv::fisheye::stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayO int a = cv::countNonZero(intrinsicLeft.isEstimate); int b = cv::countNonZero(intrinsicRight.isEstimate); cv::Mat deltas = J2_inv * J.t() * e; - intrinsicLeft = intrinsicLeft + deltas.rowRange(0, a); - intrinsicRight = intrinsicRight + deltas.rowRange(a, a + b); + if (a > 0) + intrinsicLeft = intrinsicLeft + deltas.rowRange(0, a); + if (b > 0) + intrinsicRight = intrinsicRight + deltas.rowRange(a, a + b); omcur = omcur + cv::Vec3d(deltas.rowRange(a + b, a + b + 3)); Tcur = Tcur + cv::Vec3d(deltas.rowRange(a + b + 3, a + b + 6)); for (int image_idx = 0; image_idx < n_images; ++image_idx)