1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Moved irrelevant tests and functions from calib module to 3d.

This commit is contained in:
Alexander Smorkalov
2026-04-14 13:26:35 +03:00
parent 66e994d839
commit 99fc573913
6 changed files with 1464 additions and 1047 deletions
+40
View File
@@ -66,6 +66,46 @@ Mat getDefaultNewCameraMatrix( InputArray _cameraMatrix, Size imgsize,
return newCameraMatrix;
}
void calibrationMatrixValues( InputArray _cameraMatrix, Size imageSize,
double apertureWidth, double apertureHeight,
double& fovx, double& fovy, double& focalLength,
Point2d& principalPoint, double& aspectRatio )
{
CV_INSTRUMENT_REGION();
if(_cameraMatrix.size() != Size(3, 3))
CV_Error(cv::Error::StsUnmatchedSizes, "Size of cameraMatrix must be 3x3!");
Matx33d A;
_cameraMatrix.getMat().convertTo(A, CV_64F);
CV_DbgAssert(imageSize.width != 0 && imageSize.height != 0 && A(0, 0) != 0.0 && A(1, 1) != 0.0);
/* Calculate pixel aspect ratio. */
aspectRatio = A(1, 1) / A(0, 0);
/* Calculate number of pixel per realworld unit. */
double mx, my;
if(apertureWidth != 0.0 && apertureHeight != 0.0) {
mx = imageSize.width / apertureWidth;
my = imageSize.height / apertureHeight;
} else {
mx = 1.0;
my = aspectRatio;
}
/* Calculate fovx and fovy. */
fovx = atan2(A(0, 2), A(0, 0)) + atan2(imageSize.width - A(0, 2), A(0, 0));
fovy = atan2(A(1, 2), A(1, 1)) + atan2(imageSize.height - A(1, 2), A(1, 1));
fovx *= 180.0 / CV_PI;
fovy *= 180.0 / CV_PI;
/* Calculate focal length. */
focalLength = A(0, 0) / mx;
/* Calculate principle point. */
principalPoint = Point2d(A(0, 2) / mx, A(1, 2) / my);
}
static Ptr<ParallelLoopBody> getInitUndistortRectifyMapComputer(Size _size, Mat &_map1, Mat &_map2, int _m1type,
const double* _ir, Matx33d &_matTilt,
double _u0, double _v0, double _fx, double _fy,