mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
Moved irrelevant tests and functions from calib module to 3d.
This commit is contained in:
@@ -2412,6 +2412,32 @@ float initWideAngleProjMap(InputArray cameraMatrix, InputArray distCoeffs,
|
||||
m1type, map1, map2, (UndistortTypes)projType, alpha);
|
||||
}
|
||||
|
||||
/** @brief Computes useful camera characteristics from the camera intrinsic matrix.
|
||||
*
|
||||
* @param cameraMatrix Input camera intrinsic matrix that can be estimated by #calibrateCamera or
|
||||
* #stereoCalibrate .
|
||||
* @param imageSize Input image size in pixels.
|
||||
* @param apertureWidth Physical width in mm of the sensor.
|
||||
* @param apertureHeight Physical height in mm of the sensor.
|
||||
* @param fovx Output field of view in degrees along the horizontal sensor axis.
|
||||
* @param fovy Output field of view in degrees along the vertical sensor axis.
|
||||
* @param focalLength Focal length of the lens in mm.
|
||||
* @param principalPoint Principal point in mm.
|
||||
* @param aspectRatio \f$f_y/f_x\f$
|
||||
*
|
||||
* The function computes various useful camera characteristics from the previously estimated camera
|
||||
* matrix.
|
||||
*
|
||||
* @note
|
||||
* Do keep in mind that the unity measure 'mm' stands for whatever unit of measure one chooses for
|
||||
* the chessboard pitch (it can thus be any value).
|
||||
*/
|
||||
CV_EXPORTS_W void calibrationMatrixValues( InputArray cameraMatrix, Size imageSize,
|
||||
double apertureWidth, double apertureHeight,
|
||||
CV_OUT double& fovx, CV_OUT double& fovy,
|
||||
CV_OUT double& focalLength, CV_OUT Point2d& principalPoint,
|
||||
CV_OUT double& aspectRatio );
|
||||
|
||||
/** @brief Returns the default new camera matrix.
|
||||
|
||||
The function returns the camera matrix that is either an exact copy of the input cameraMatrix (when
|
||||
|
||||
@@ -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,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1051,32 +1051,6 @@ CV_EXPORTS_W double calibrateCameraRO( InputArrayOfArrays objectPoints,
|
||||
int flags = 0, TermCriteria criteria = TermCriteria(
|
||||
TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON) );
|
||||
|
||||
/** @brief Computes useful camera characteristics from the camera intrinsic matrix.
|
||||
|
||||
@param cameraMatrix Input camera intrinsic matrix that can be estimated by #calibrateCamera or
|
||||
#stereoCalibrate .
|
||||
@param imageSize Input image size in pixels.
|
||||
@param apertureWidth Physical width in mm of the sensor.
|
||||
@param apertureHeight Physical height in mm of the sensor.
|
||||
@param fovx Output field of view in degrees along the horizontal sensor axis.
|
||||
@param fovy Output field of view in degrees along the vertical sensor axis.
|
||||
@param focalLength Focal length of the lens in mm.
|
||||
@param principalPoint Principal point in mm.
|
||||
@param aspectRatio \f$f_y/f_x\f$
|
||||
|
||||
The function computes various useful camera characteristics from the previously estimated camera
|
||||
matrix.
|
||||
|
||||
@note
|
||||
Do keep in mind that the unity measure 'mm' stands for whatever unit of measure one chooses for
|
||||
the chessboard pitch (it can thus be any value).
|
||||
*/
|
||||
CV_EXPORTS_W void calibrationMatrixValues( InputArray cameraMatrix, Size imageSize,
|
||||
double apertureWidth, double apertureHeight,
|
||||
CV_OUT double& fovx, CV_OUT double& fovy,
|
||||
CV_OUT double& focalLength, CV_OUT Point2d& principalPoint,
|
||||
CV_OUT double& aspectRatio );
|
||||
|
||||
/** @brief Calibrates a stereo camera set up. This function finds the intrinsic parameters
|
||||
for each of the two cameras and the extrinsic parameters between the two cameras.
|
||||
|
||||
|
||||
@@ -3014,47 +3014,6 @@ double calibrateCameraRO(InputArrayOfArrays _objectPoints,
|
||||
return reprojErr;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
double stereoCalibrate( InputArrayOfArrays _objectPoints,
|
||||
InputArrayOfArrays _imagePoints1,
|
||||
InputArrayOfArrays _imagePoints2,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user