Lab: AprilTags

From Tekkotsu Wiki

Jump to: navigation, search

In this lab you will learn about AprilTags, a kind of binary marker used in robot vision. AprilTags are grayscale images, so they are less sensitive to lighting conditions than color-based markers.


Background Reading

The AprilTags article contains information on the history of AprilTags and links to YouTube videos demonstrating ARTags, a predecessor of AprilTags.

Running the AprilTest Demo

Read the AprilTest demo article for instructions on how to run the demo. Try it out.

You will need to print some AprilTags to run the demo. Print out this file for the set of 30 tags from the 16h5 family:


Now try the following exercises:

  1. Hold up a tag to the camera, run the demo, and then click on the Save Image button in the SketchGUI to save a copy of the display showing the detected tag.
  2. Rotate the paper by 90 degrees and run the demo again. Save this image as well.
  3. How does the display indicate that the tag is rotated?

Running the TagTest Demo

TagTest is a Java program from Edwin Olson that provides a real-time display of tag detections. The experiments below can also be done with the AprilTest demo, but using TagTest is more convenient. Read the AprilTags article for instructions on how to install and run the TagTest demo. Note that you will need a different set of tags for this; you need tags from the 36h11 family. The AprilTags article includes an image with some of these 36h11 tags that you can print.

  1. Hold up an AprilTag to the camera and verify that it is recognized.
  2. Turn the paper slightly sideways, so that the camera image is skewed. Is the tag still recognized?
  3. How much can you skew the paper before the algorithm fails to recognize the tag? Estimate the angle in degrees.
  4. Fold the paper slightly, so that its surface is curved. How much curvature can you introduce before the algorithm fails to recognize the tag?
  5. Hold the paper flat and move it farther away from the camera, so that the tag is smaller in the camera image. How small can it be and still be recognized reliably? Give your answer in inches.
  6. Use your finger to cover up part of the tag. How many bits can you cover and still have the tag be recognized?
  7. Try varying the lighting. If you turn the room lights off, or alternatively, shine a lamp on the paper, is the tag still recognized?
  8. Try drawing a tag by hand, using a magic marker. Is your tag recognized?

Understanding the Algorithm

  1. Read the section How the Algorithm Works in the AprilTags article.
  2. Run the TagTest demo, right-control click on the display to bring up a menu, click on Select Buffer, and then click on Detach to detach the menu.
  3. Hold up a single large AprilTag to the camera.
  4. Click on the Disable All button to clear the display.
  5. Click on the "mag" checkbox to see the local gradient magnitudes.
  6. Clear the "mag" checkbox and click on the "segmentation" checkbox to see the Segments extracted from the image.
  7. Clear the "segmentation" checkbox and click on the "input" and "quads" checkboxes to see the extracted Quads.
  8. Click on the "detections" checkbox to see the TagDetections.