My next project involves using a Raspberry Pi to do motion tracking. Not something that is difficult nowadays with well developed libraries for image processing like OpenCV.
What I did discover is that a lot of the example code I found was targetted at more powerful things than the Pi and runs at a snail's pace.
So I took one of these projects as a starting point and after initially trying to slim it down and failing I've started from scratch, taking inspiration from a couple of the examples I found.
I now have some Python/OpenCV code that will do >25fps from a USB webcam on the Pi if you keep the source image small.
Here's some of the output of this, with the object outlined and the green blobs showing the track it has moved through. My next step is to do some anticipation so it can track ahead of the object.
Ideally you need to overclock the Pi for best performance but if you only use a 160x120 source image it's still fine at 700Mhz.
I've ordered a Beaglebone Black for this project by way of an upgrade, but for now I'll stick with the Pi as I've managed to squeeze enough performance out of it to be going on with.
To keep power use and heat down the script drops the FPS deliberately when nothing is moving and then ramps up when something happens. I'm not sure if this is 100% necessary but it feels like something you should do and the temperature definitely stays down a bit.
1 comment:
Post a Comment