← udacity portfolio
ml cv other · computer vision · September 2019

pyAprilTag (Python wrapper)

Python bindings for the AprilTag fiducial detector via OpenCV's cv2cg, used in a Robot Perception course. A fork, not original work.

What it did

Used the AprilTag fiducial system as the localization input for an Indoor robotics class. Pin a known-size tag to a wall, point a calibrated camera at it, recover the camera’s pose relative to the tag in real-time. This was an upstream wrapper repo I forked to make a small build/calibration tweak — not original work.

How it’s used

  1. Calibrate the camera once (cv2.calibrateCamera from a chessboard pattern) — produces intrinsics K and distortion coefficients.
  2. AprilTag detector returns 4 corner pixels per tag.
  3. solvePnP recovers the 6-DOF tag→camera transform from the corners
    • known tag size.
  4. Compose with a known tag→world transform to get camera→world.

What was actually tricky

What I’d do differently with hindsight

What it taught me

Fiducials are the cheap-and-reliable answer when the environment permits — far more robust than feature-based localization for indoor robots. The lesson generalized: when you can engineer the world (tags, light, color), don’t over-engineer the perception. Save the CV firepower for the cases you can’t control.


Source archive: Shivam-Bhardwaj/pyAprilTag (archived)
Writeup last touched: 2026-05-22