Skip to content

Commit fa42a1c

Browse files
Прун ВикторПрун Виктор
authored andcommitted
fix calib3d changes in #6836 plus some others
1 parent df91207 commit fa42a1c

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

modules/calib3d/src/calibration.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,8 +1210,8 @@ CV_IMPL void cvInitIntrinsicParams2D( const CvMat* objectPoints,
12101210

12111211
matA.reset(cvCreateMat( 2*nimages, 2, CV_64F ));
12121212
_b.reset(cvCreateMat( 2*nimages, 1, CV_64F ));
1213-
a[2] = (!imageSize.width) ? 0.5 : (imageSize.width - 1)*0.5;
1214-
a[5] = (!imageSize.height) ? 0.5 : (imageSize.height - 1)*0.5;
1213+
a[2] = (!imageSize.width) ? 0.5 : (imageSize.width)*0.5;
1214+
a[5] = (!imageSize.height) ? 0.5 : (imageSize.height)*0.5;
12151215
_allH.reset(cvCreateMat( nimages, 9, CV_64F ));
12161216

12171217
// extract vanishing points in order to obtain initial value for the focal length
@@ -2494,8 +2494,8 @@ void cvGetOptimalNewCameraMatrix( const CvMat* cameraMatrix, const CvMat* distCo
24942494
{
24952495
double cx0 = M[0][2];
24962496
double cy0 = M[1][2];
2497-
double cx = (newImgSize.width-1)*0.5;
2498-
double cy = (newImgSize.height-1)*0.5;
2497+
double cx = (newImgSize.width)*0.5;
2498+
double cy = (newImgSize.height)*0.5;
24992499

25002500
icvGetRectangles( cameraMatrix, distCoeffs, 0, cameraMatrix, imgSize, inner, outer );
25012501
double s0 = std::max(std::max(std::max((double)cx/(cx0 - inner.x), (double)cy/(cy0 - inner.y)),
@@ -2529,14 +2529,14 @@ void cvGetOptimalNewCameraMatrix( const CvMat* cameraMatrix, const CvMat* distCo
25292529
icvGetRectangles( cameraMatrix, distCoeffs, 0, 0, imgSize, inner, outer );
25302530

25312531
// Projection mapping inner rectangle to viewport
2532-
double fx0 = (newImgSize.width - 1) / inner.width;
2533-
double fy0 = (newImgSize.height - 1) / inner.height;
2532+
double fx0 = (newImgSize.width) / inner.width;
2533+
double fy0 = (newImgSize.height) / inner.height;
25342534
double cx0 = -fx0 * inner.x;
25352535
double cy0 = -fy0 * inner.y;
25362536

25372537
// Projection mapping outer rectangle to viewport
2538-
double fx1 = (newImgSize.width - 1) / outer.width;
2539-
double fy1 = (newImgSize.height - 1) / outer.height;
2538+
double fx1 = (newImgSize.width) / outer.width;
2539+
double fy1 = (newImgSize.height) / outer.height;
25402540
double cx1 = -fx1 * outer.x;
25412541
double cy1 = -fy1 * outer.y;
25422542

@@ -2600,8 +2600,8 @@ CV_IMPL int cvStereoRectifyUncalibrated(
26002600
cvGEMM( &U, &W, 1, 0, 0, &W, CV_GEMM_A_T );
26012601
cvMatMul( &W, &V, &F );
26022602

2603-
cx = cvRound( (imgSize.width-1)*0.5 );
2604-
cy = cvRound( (imgSize.height-1)*0.5 );
2603+
cx = cvRound( (imgSize.width)*0.5 );
2604+
cy = cvRound( (imgSize.height)*0.5 );
26052605

26062606
cvZero( _H1 );
26072607
cvZero( _H2 );

0 commit comments

Comments
 (0)