AprilRobotics / apriltag

AprilTag is a visual fiducial system popular for robotics research.
https://april.eecs.umich.edu/software/apriltag
Other
1.47k stars 522 forks source link

What is the fix matrix that you multiply with the pose? #270

Open mehditlili opened 1 year ago

mehditlili commented 1 year ago

I am trying to understand the different elements of the code. However, I fail to see why you multiply by a matrix called fix when computing the tag pose. I have an intuition that it has something to do with the direction of the Z axis pointing away or to the camera but why can't that be directly estimated via the homography?

Here is the matrix in question https://github.com/AprilRobotics/apriltag/blob/master/apriltag_pose.c#L463

Could one of the authors please elaborate on this or point to an article where they describe why this is necessary?

Thank you

christian-rauch commented 5 months ago

I did not write that code but your intuition is correct. That matrix is flipping the y- and z-axes so that the z-axis of the tag frame is pointing away from the tag surface towards the camera.

This is essentially also done in the ROS node by setting the objectPoints for cv::solvePnP accordingly. The relation of the 3D points (objectPoints) and the order of the corresponding 2D coordinates (imagePoints) of the detected tag define a coordinate system where z is also "flipped".