Merge remote-tracking branch 'upstream/3.4' into merge-3.4

This commit is contained in:
Alexander Alekhin
2021-03-13 13:02:18 +00:00
19 changed files with 233 additions and 38 deletions
@@ -418,7 +418,12 @@ int main(int argc, char* argv[])
{
Mat temp = view.clone();
if (s.useFisheye)
cv::fisheye::undistortImage(temp, view, cameraMatrix, distCoeffs);
{
Mat newCamMat;
fisheye::estimateNewCameraMatrixForUndistortRectify(cameraMatrix, distCoeffs, imageSize,
Matx33d::eye(), newCamMat, 1);
cv::fisheye::undistortImage(temp, view, cameraMatrix, distCoeffs, newCamMat);
}
else
undistort(temp, view, cameraMatrix, distCoeffs);
}
@@ -547,7 +552,7 @@ static bool runCalibration( Settings& s, Size& imageSize, Mat& cameraMatrix, Mat
{
//! [fixed_aspect]
cameraMatrix = Mat::eye(3, 3, CV_64F);
if( s.flag & CALIB_FIX_ASPECT_RATIO )
if( !s.useFisheye && s.flag & CALIB_FIX_ASPECT_RATIO )
cameraMatrix.at<double>(0,0) = s.aspectRatio;
//! [fixed_aspect]
if (s.useFisheye) {
@@ -630,7 +635,7 @@ static void saveCameraParams( Settings& s, Size& imageSize, Mat& cameraMatrix, M
fs << "board_height" << s.boardSize.height;
fs << "square_size" << s.squareSize;
if( s.flag & CALIB_FIX_ASPECT_RATIO )
if( !s.useFisheye && s.flag & CALIB_FIX_ASPECT_RATIO )
fs << "fix_aspect_ratio" << s.aspectRatio;
if (s.flag)