Learn CV
RIFT vision workshop

Learn CV

Hold something bright up to your camera and build a tracker for it. First the basics: get a picture from the camera, and read the numbers inside it. Then a colour mask, a contour fit, a Kalman filter that keeps tracking while it's hidden, and a finger counter. You write ordinary OpenCV in Python, the same code that runs on a laptop or on the robot.

Before you start

1. Camera
2. Python

Python, NumPy and OpenCV run in your browser. The first download is about 27 MB; after that it's kept for next time.

3. An object

Anything solid and brightly coloured: a tennis ball, a sticky note, a marker cap. Plain colours beat patterns. For level 6, sit in front of a plain wall.

Levels

  1. 01Camera on4 minShow the camera in a window, and a greyscale copy, gray, in a second window.
  2. 02Pixels6 minSet picked to the average H, S and V of the 10 × 10 square in the middle of the frame.
  3. 03See it7 minMake mask white on your object and black elsewhere.
  4. 04Find it9 minSet center to the object's (x, y) every frame, or None when it's not there.
  5. 05Track it14 minSet estimate to the filtered position every frame, including while the ball is hidden, and aim to where it will be LEAD seconds from now.
  6. 06Count fingers9 minSet fingers to how many fingers are up, 0 to 5.
  7. 07Armor platesdemoRun it and watch it pair the bars.