@@ -1782,13 +1782,15 @@ void cv::omnidir::internal::estimateUncertainties(InputArrayOfArrays objectPoint
17821782
17831783 Mat sigma_x;
17841784 meanStdDev (reprojError.reshape (1 ,1 ), noArray (), sigma_x);
1785- sigma_x *= sqrt (2.0 *(double )reprojError.total ()/(2.0 *(double )reprojError.total () - 1.0 ));
1786- double s = sigma_x.at <double >(0 );
17871785
17881786 Mat _JTJ_inv, _JTE;
17891787 computeJacobian (objectPoints, imagePoints, parameters, _JTJ_inv, _JTE, flags, 0.0 );
17901788 sqrt (_JTJ_inv, _JTJ_inv);
17911789
1790+ int nParams = _JTJ_inv.rows ;
1791+ sigma_x *= sqrt (2.0 *(double )reprojError.total ()/(2.0 *(double )reprojError.total () - nParams));
1792+ double s = sigma_x.at <double >(0 );
1793+
17921794 errors = 3 * s * _JTJ_inv.diag ();
17931795
17941796 rms = 0 ;
@@ -1868,13 +1870,15 @@ void cv::omnidir::internal::estimateUncertaintiesStereo(InputArrayOfArrays objec
18681870
18691871 Mat sigma_x;
18701872 meanStdDev (reprojErrorAll.reshape (1 ,1 ), noArray (), sigma_x);
1871- sigma_x *= sqrt (2.0 *(double )reprojErrorAll.total ()/(2.0 *(double )reprojErrorAll.total () - 1.0 ));
1872- double s = sigma_x.at <double >(0 );
18731873
18741874 Mat _JTJ_inv, _JTE;
18751875 computeJacobianStereo (objectPoints, imagePoints1, imagePoints2, _parameters, _JTJ_inv, _JTE, flags, 0.0 );
18761876 cv::sqrt (_JTJ_inv, _JTJ_inv);
18771877
1878+ int nParams = _JTJ_inv.rows ;
1879+ sigma_x *= sqrt (2.0 *(double )reprojErrorAll.total ()/(2.0 *(double )reprojErrorAll.total () - nParams));
1880+ double s = sigma_x.at <double >(0 );
1881+
18781882 errors = 3 * s * _JTJ_inv.diag ();
18791883
18801884 rms = 0 ;
0 commit comments