Pan Tilt #3: Colour Tracking

May 24, 2015

I finished Post 2 having calibrated the pan tilt mechanism. For a given location of a detected target, we can look up the exact movement required to slew the servo's so that the camera is centered on that object.
With that as a base, I coded up a colour tracking controller for the pan tilt platform. Here it is in action on the Model B+:

The inset in the video shows what the Pi camera is seeing. The pixelated look is because it is capturing at 64x48 pixels. The lower the resolution, the less data to process, the more frames can be processed per second, thus making the tracking more responsive. As you can see colour tracking doesn't require particularly high resolution.

Below is a table of colour tracking frame rates observed at each resolution. The values don't come up to exactly what is shown in the video since these measurements were taken on pure colour tracking code without the pan tilt controller.

  Framerate (ms) / 10 frames
Resolution (pixels) Model B+ Pi 2 (tbb=false) Pi 2 (tbb=true)
64x48 480 400 190
128x96 750 400 230
160x120 960-1400 400 270
320x240 2300 700 630-680

The video is made with the Model B+