AprilRobotics / apriltag_ros

A ROS wrapper of the AprilTag 3 visual fiducial detector
Other
358 stars 338 forks source link

Tag size definition is misleading for tagStandard, tagCircle, tagCustom #116

Closed BenzStefanBosch closed 2 years ago

BenzStefanBosch commented 2 years ago

For AprilTag3 tags (tagStandard, tagCircle, tagCustom) the tag size appears to be defined as the area within the solid black rectangle, leading to misleading size definitions in the tags.yaml.

We observed severe errors in the distance estimation of the markers when using tagStandard41h12 markers, so we investigated the subject further. Looking at the detection images, we noticed that the detection rectangle is drawn on the border of the solid white and solid black square, not around the outermost data bits. This holds true for tagCircle and tagCustom classes as well. For the 'old' tag36h11 the detection size specifies the size of the outer black box, which makes more sense.

IMO the more intuitive measure for "tag size" would be to always use the outermost data bits or black pixels. For the case of tagStandard41h12 there are 9 data bits, the currently implemented tag size refers to the inner 5 bits, leading to an error in depth estimation of 9/5 = 1.8 and this varies depending on the number or data bits per row.

I suspect the reason lies in the workings of the underlying detector and hence would be challenging to change quickly. Once it is known which size to specify, this can easily be corrected when setting up the tags.yaml, but as mentioned it is unintuitive and should at least be defined in the comments of tags.yaml or the documentation.

BenzStefanBosch commented 2 years ago

Detection_size_guide_marked Here is an overview to visualize the different sizes that need to be specified to get a correct distance estimate.

BenzStefanBosch commented 2 years ago

So I stumbled upon the official description for the tag sizes here: https://github.com/AprilRobotics/apriltag/wiki/AprilTag-User-Guide#pose-estimation

Still, I think a comment regarding this would be helpful somewhere in the config where you are expected to specify the size.

wxmerkt commented 2 years ago

Thank you very much for raising this important point and providing examples. Could you please open a PR to update the README/documentation with the above graphic and description? Many thanks in advance!