Ask Your Question
0

OpenCV Error: Bad argument (For non-planar calibration rigs the initial intrinsic matrix must be specified) in cvCalibrateCamera2

asked 2013-07-09 03:19:25 -0600

laks.it gravatar image

Hi there! I'm trying to compute the camera matrix using a series of (2D <-> 3D) correspondences not acquired from a planar rig. From the documentation of calibrateCamera() it seems possible to use it also in this way but, when I run my program, I get this error:

OpenCV Error: Bad argument (For non-planar calibration rigs the initial intrinsic matrix must be specified) in cvCalibrateCamera2, file /opt/local/var/macports/build/_opt_mports_dports_graphics_opencv/opencv/work/opencv-2.4.5/modules/calib3d/src/calibration.cpp, line 1592 terminate called throwing an exception

The code is very simple, here is a sketch

vector<vector<Point3f> > objectPoints;
vector<vector<Point2f> > imagePoints;
......
   ...insert 3D and 2D points in objectPoint and imagePoints
......
Mat cameraMatrix= Mat(3, 3, CV_64F);
Mat distCoeffs;
vector<Mat> rvecs; //rotation vector
vector<Mat> tvecs;//translation vector

calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs);

Does anybody know what's wrong? Thanks in advance!

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2014-02-23 00:29:56 -0600

somedev gravatar image

To make the cameraCalibrate function use the initial cameraMatrix you specified, you have to give a flags parameter with the value CV_CALIB_USE_INTRINSIC_GUESS;

try

calibrateCamera(objectPoints,imagePoints,imageSize,cameraMatrix,distCoeffs,rvecs,tvecs,CV_CALIB_USE_INTRINSIC_GUESS);

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-07-09 03:19:25 -0600

Seen: 6,818 times

Last updated: Feb 23 '14