Unexpected cameraMatrix from calibrateCamera

asked 2018-05-08 13:03:10 -0500

IC++ gravatar image

updated 2018-05-08 14:07:33 -0500

When calling calibrateCamera I specify the CV_CALIB_FIX_PRINCIPAL_POINT flag. So I expect the cx and cy of the resulting cameraMatrix to reflect the middle of the screen. My camera is 1280 width and 1024 high. But I get a cx of 512 and a cy of 640. I expected the other way around because x is in the width direction. Do I misunderstand something?

edit retag flag offensive close merge delete


Are you sure you are populating the cameraMatrix with the correct Cx, Cy before passing it in to calibrateCamera?

Maybe add to your question with an example image, and copy and paste in a code snippet just long enough to show the problem, along with some debug output?

Finally, what version of openCV are you using, on what architecture platform?

opalmirror gravatar imageopalmirror ( 2018-05-08 13:51:42 -0500 )edit

OpenCV 3.4.1 on Windows 10 According the documentation, calibrateCamera will set cx and cy to the middle of the screen. So the values 512 and 640 do make sense. But I do not understand that cx = 512 instead of 640. And cy = 640 in tead of 512.

IC++ gravatar imageIC++ ( 2018-05-08 14:07:07 -0500 )edit

If you print out the imageSize parameter height (y) and width (x) are they 1024 and 1280 too?

opalmirror gravatar imageopalmirror ( 2018-05-08 17:13:49 -0500 )edit