ArUco Image Coordinate System


I am not sure how image coordinates are interpreted in OpenCV. I hope you guys can help me out.

I understand that the origin of the coordinate system is in the top left corner of the image, but I did not yet find a definite answer to the question, if integer coordinates fall on the top left border of a pixel or on its center.

I ran cv::aruco::interpolateCornersCharuco( ... ) and cv::findChessboardCorners( ... ) on the same ChArUco board and the results were inconsitent. The former suggests that the coordinate grid lies on the pixel borders, the latter, that it lies in the center of the pixels. The drawing functions (like cv::circle( ... ) also suggest the center of the pixels. I’m all the more confused, as cv::aruco::interpolateCornersCharuco( ... ) and cv::calibrateCamera( ... ) seem to both use cv::solvePnP( ... ) without modulating the coordinates. Maybe I oversaw something, but this suggests to me, that the functions would yield inconsistent camera parameters for the same input images.

For camera matrices the question translates to: Is the principle point for a perfect pinhole camera ( img_width / 2, img_height / 2 ) or ( (img_width - 1 ) / 2, (img_height - 1 ) / 2 ). For the simplest case of a point on the optical axis, one can determine, that for the former, the projection would be in the center of pixel border coordinate system and for the latter it would be in the center of the pixel center coordinate system.


1 Like

that. pixel centers are integers.

and yes, for a perfect pinhole, the principal point is (w-1)/2, (h-1)/2, i.e. if the camera has 2x2 pixels, it sits on the corners between all those four.

IDK if these things are documented properly anywhere but it’s the fundamental assumption.

it also explains “funny” behavior by resize(). it maps whole areas from pixel corner to pixel corner, not just putting the top left and bottom right pixel centers on top of each other.

4x4 example, resized to +1 width +1 height (and then magnified for display):

image image

the aruco module is an entirely different matter. I wouldn’t quite trust it right now. lots of changes happening right now. some changes broke compatibility previously acceptable calibration patterns.

many people lack the attention to detail to care about these things. this is an uphill battle.