Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What about documentation? http://opencv.willowgarage.com/documentation/cpp/camera_calibration_and_3d_reconstruction.html

The output param cameraMatrix - intrinsic camera parameters, non rotation matrix.

This matrix is input in calibrationMatrixValues function.

In c++ it's look like this

int w = 640, h = 480; // for example
cv::calibrateCamera(objectPoints, imagePoints, cv::Size(w, h), cameraMatrix, distCoeffs, rvecs, tvecs);
cv::calibrationMatrixValues(cameraMatrix, cv::Size(w, h), apertureWidth, apertureHeight, fieldOfViewX, fieldOfViewY, focalLength, principalPoint, aspectRatio);

But not all devices give you the apertureHeight information, thats why you can compute angles, using this formula

fx = cameraMatrix.at<double>(0);
fy = cameraMatrix.at<double>(4);
fovx = 2 * atan(imgWidth / (2 * fx)) * 180.0 / CV_PI;
fovy = 2 * atan(imgHeight / (2 * fy)) * 180.0 / CV_PI;

Fx and Fy = its elements of cameraMatrix image description