From 5ca7dcc6e74b9c6068b8de1f49f289d6bc6b5a0b Mon Sep 17 00:00:00 2001 From: Alexander Duda Date: Sat, 1 Jul 2017 13:31:21 -0230 Subject: [PATCH] Fix error message fisheye CALIB_CHECK_COND The old error message was not giving any hint which input array (image) led to an ill conditioned matrix. This made it near impossible to identify poor images in a larger set. A better approach would be to implement a checker function which gives each image a rating before the real calibration is performed. This could also include some image properties like sharpness, etc. --- modules/calib3d/src/fisheye.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/calib3d/src/fisheye.cpp b/modules/calib3d/src/fisheye.cpp index 05bd37b74f..0f9e85c4e6 100644 --- a/modules/calib3d/src/fisheye.cpp +++ b/modules/calib3d/src/fisheye.cpp @@ -1401,7 +1401,8 @@ void cv::internal::CalibrateExtrinsics(InputArrayOfArrays objectPoints, InputArr if (check_cond) { SVD svd(JJ_kk, SVD::NO_UV); - CV_Assert(svd.w.at(0) / svd.w.at((int)svd.w.total() - 1) < thresh_cond); + if(svd.w.at(0) / svd.w.at((int)svd.w.total() - 1) > thresh_cond ) + CV_Error( cv::Error::StsInternal, format("CALIB_CHECK_COND - Ill-conditioned matrix for input array %d",image_idx)); } omckk.reshape(3,1).copyTo(omc.getMat().col(image_idx)); Tckk.reshape(3,1).copyTo(Tc.getMat().col(image_idx));