From 8f995fac881cb70a97d799a6f9881045c5443da6 Mon Sep 17 00:00:00 2001 From: Kevin Date: Sat, 19 Oct 2013 01:30:03 -0500 Subject: [PATCH] Change intrinsic camera matrix initialization In the function cvInitIntrinsicParams2D the principal point for normalized image coordinates is set to 0/0. This updates the function to initialize the principal point at 0.5/0.5. --- modules/calib3d/src/calibration.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/calib3d/src/calibration.cpp b/modules/calib3d/src/calibration.cpp index e483935028..d9e821db41 100644 --- a/modules/calib3d/src/calibration.cpp +++ b/modules/calib3d/src/calibration.cpp @@ -1391,8 +1391,8 @@ CV_IMPL void cvInitIntrinsicParams2D( const CvMat* objectPoints, matA = cvCreateMat( 2*nimages, 2, CV_64F ); _b = cvCreateMat( 2*nimages, 1, CV_64F ); - a[2] = (imageSize.width - 1)*0.5; - a[5] = (imageSize.height - 1)*0.5; + a[2] = (!imageSize.width) ? 0.5 : (imageSize.width - 1)*0.5; + a[5] = (!imageSize.height) ? 0.5 : (imageSize.height - 1)*0.5; _allH = cvCreateMat( nimages, 9, CV_64F ); // extract vanishing points in order to obtain initial value for the focal length