mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-20 21:40:49 +08:00
omnidir: fix wrong memory access in estimateUncertainties
This commit is contained in:
@@ -278,8 +278,6 @@ namespace internal
|
|||||||
double computeMeanReproErrStereo(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2, InputArray K1, InputArray K2,
|
double computeMeanReproErrStereo(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2, InputArray K1, InputArray K2,
|
||||||
InputArray D1, InputArray D2, double xi1, double xi2, InputArray om, InputArray T, InputArrayOfArrays omL, InputArrayOfArrays TL);
|
InputArray D1, InputArray D2, double xi1, double xi2, InputArray om, InputArray T, InputArrayOfArrays omL, InputArrayOfArrays TL);
|
||||||
|
|
||||||
void checkFixed(Mat &G, int flags, int n);
|
|
||||||
|
|
||||||
void subMatrix(const Mat& src, Mat& dst, const std::vector<int>& cols, const std::vector<int>& rows);
|
void subMatrix(const Mat& src, Mat& dst, const std::vector<int>& cols, const std::vector<int>& rows);
|
||||||
|
|
||||||
void flags2idx(int flags, std::vector<int>& idx, int n);
|
void flags2idx(int flags, std::vector<int>& idx, int n);
|
||||||
@@ -309,4 +307,4 @@ namespace internal
|
|||||||
} // omnidir
|
} // omnidir
|
||||||
|
|
||||||
} //cv
|
} //cv
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1785,8 +1785,6 @@ void cv::omnidir::internal::estimateUncertainties(InputArrayOfArrays objectPoint
|
|||||||
|
|
||||||
errors = 3 * s * _JTJ_inv.diag();
|
errors = 3 * s * _JTJ_inv.diag();
|
||||||
|
|
||||||
checkFixed(errors, flags, n);
|
|
||||||
|
|
||||||
rms = 0;
|
rms = 0;
|
||||||
const Vec2d* ptr_ex = reprojError.ptr<Vec2d>();
|
const Vec2d* ptr_ex = reprojError.ptr<Vec2d>();
|
||||||
for (int i = 0; i < (int)reprojError.total(); i++)
|
for (int i = 0; i < (int)reprojError.total(); i++)
|
||||||
@@ -1995,52 +1993,6 @@ double cv::omnidir::internal::computeMeanReproErrStereo(InputArrayOfArrays objec
|
|||||||
return reProErr;
|
return reProErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::omnidir::internal::checkFixed(Mat& G, int flags, int n)
|
|
||||||
{
|
|
||||||
int _flags = flags;
|
|
||||||
if(_flags >= omnidir::CALIB_FIX_CENTER)
|
|
||||||
{
|
|
||||||
G.at<double>(6*n+3) = 0;
|
|
||||||
G.at<double>(6*n+4) = 0;
|
|
||||||
_flags -= omnidir::CALIB_FIX_CENTER;
|
|
||||||
}
|
|
||||||
if(_flags >= omnidir::CALIB_FIX_GAMMA)
|
|
||||||
{
|
|
||||||
G.at<double>(6*n) = 0;
|
|
||||||
G.at<double>(6*n+1) = 0;
|
|
||||||
_flags -= omnidir::CALIB_FIX_GAMMA;
|
|
||||||
}
|
|
||||||
if(_flags >= omnidir::CALIB_FIX_XI)
|
|
||||||
{
|
|
||||||
G.at<double>(6*n + 5) = 0;
|
|
||||||
_flags -= omnidir::CALIB_FIX_XI;
|
|
||||||
}
|
|
||||||
if(_flags >= omnidir::CALIB_FIX_P2)
|
|
||||||
{
|
|
||||||
G.at<double>(6*n + 9) = 0;
|
|
||||||
_flags -= omnidir::CALIB_FIX_P2;
|
|
||||||
}
|
|
||||||
if(_flags >= omnidir::CALIB_FIX_P1)
|
|
||||||
{
|
|
||||||
G.at<double>(6*n + 8) = 0;
|
|
||||||
_flags -= omnidir::CALIB_FIX_P1;
|
|
||||||
}
|
|
||||||
if(_flags >= omnidir::CALIB_FIX_K2)
|
|
||||||
{
|
|
||||||
G.at<double>(6*n + 7) = 0;
|
|
||||||
_flags -= omnidir::CALIB_FIX_K2;
|
|
||||||
}
|
|
||||||
if(_flags >= omnidir::CALIB_FIX_K1)
|
|
||||||
{
|
|
||||||
G.at<double>(6*n + 6) = 0;
|
|
||||||
_flags -= omnidir::CALIB_FIX_K1;
|
|
||||||
}
|
|
||||||
if(_flags >= omnidir::CALIB_FIX_SKEW)
|
|
||||||
{
|
|
||||||
G.at<double>(6*n + 2) = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This function is from fisheye.cpp
|
// This function is from fisheye.cpp
|
||||||
void cv::omnidir::internal::subMatrix(const Mat& src, Mat& dst, const std::vector<int>& cols, const std::vector<int>& rows)
|
void cv::omnidir::internal::subMatrix(const Mat& src, Mat& dst, const std::vector<int>& cols, const std::vector<int>& rows)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user