AprilTags

We're using our own custom AprilTag library, chalkydri-apriltags, built from the ground up. We'll refer to it as "CAT".

API documentation (rustdoc)

Why?

We have a few reasons for writing our own, rather than using what's already out there. The reference C library:

  • is very resource intensive
  • uses a lot of advanced math which isn't covered in high school classes, making it harder for students to understand how it works
  • has memory leaks (needs a citation)

Design overview

CAT is based on existing algorithms, but with some tweaks specific to our use case.

  1. Get a frame
  2. Grayscale & threshold
  3. Detect corners
  4. Edge checking
  5. Decode tags

Grayscale & threshold

Converting RGB to grayscale and thresholding are combined into one step for performance.

I can't find the original reference I used for grayscale values.

We need to implement "iterative tri-class adaptive thresholding" based on Otsu's method.

Corner detection

Corner detection is done using the aptly named FAST algorithm. Another advantage: it's very simple and easy to understand.

1612
153
144
13p5
126
117
1098

Edge checking

"Edge checking" reuses some of our corner detection algorithm.

We simply check a few points alongside the paths of each imaginary line between two corners.

Insert photo here

Decode tags

Decoding tags is done pretty much the same way the C library does it.

Important references