Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

NEWBIE calibrateCamera and calibrationMatrixValues

hi- i am a total newb to opencv- and to python as well. i'm trying to get a better understanding of the workings of the calibrateCamera and calibrationMatrixValues functions. i'm stepping through someone else's (working) python code. thanks in advance for your patience.

i am ultimately trying to use calibrationMatrixValues to extract the fovx and fovy from a previously (successfully) solved camera calibration using calibrateCamera. these are the settings used (where geoPoints, imgPoints, pWidth, and pHeight have been determined).

calibrateCamera((geoPoints,imgPoints),width=pWidth, height=pHeight, useIntrinsicGuess=True, fixAspectRatio=True, zeroTangentDist=True, fixPrincipalPoint=False)

calibrateCamera - the output camera matrix i get is indeed a 3x3 matrix, but it is a rotation matrix that is being used to calculate my camera's extrinsics. i think i am looking for output that is a projection matrix- so i can feed that into calibrationMatrixValues.

calibrationMatrixValues - where can i find the camera matrix to input? imageSize, is this an array of two values [x,y]? i know the image size, i'm not sure how to format it properly.

and finally- apertureWidth and apertureHeight. these i am stuck on. any guess as to how i would extract or calculate these values from calibrateCamera?


in stepping through the source code for the calibrationMatrixValues function i find:

fovx = 2 * atan(imgWidth / (2 * alphax)) * 180.0 / CV_PI; fovy = 2 * atan(imgHeight / (2 * alphay)) * 180.0 / CV_PI;

alphax and alphay are pulled directly from the input camera matrix. so, a big problem for me is the matrix i feed it looks like a rotation matrix, and this produces very unusable results.

thanks very much