a one hour level beginner project to implement visual object detection on a stock raspberry pi.
My project is a very easy implementation of computer vision on raspberry pi; feature tracking.
Most people who had buy a Raspberry Pi camera module or similar (from here and thereafter Raspicam) is somehow thinking about computer vision, but the complexity of the implementation of layers and layers of software and code in the examples is a strong entry barrier.
I hope this project will help with that; if you have a raspberry and a raspicam you should try it... it only takes one hour ;)
We are going to learn how to do tracking of objects with the camera!
but first i suggest to try my first project Raspberry Pi Object Identification. there you'll find all the steps from connecting the camera and the pi to the voice synthesis that speaks what it saw and it only takes 30 minutes.
i'll be writing step by step during the week, greetings!
we will continue using the raspberry from the last project, so first if you have not hack the first project yet please go and check the instructions to configure the Raspberry Pi and the camera.
What are we building?
The goal is to find an object in a picture and then target the camera to center the object.
For that we will use an Arduino. The Pi have pins too but cannot control by itself a servo. An Arduino can control servos without additional hardware and we can control the arduino from Mathematica.
here we can see the raspberry (in a case), the camera mount (fixed on the case with two-sided adhesive tape) connected to the arduino (each servo is 5V, GND and Signal) and the camera taped to a fitting block. Load the sketch from the files section to the Arduino (follow this instructions if you are unfamiliar) and connect the data cable from the horizontal (X) servo to PIN 9 and the vertical (Y) servo data cable to PIN 10.
If everything is OK with the arduino and the servos from the camera mount after powering the arduino the mount should stay more or less vertical (as in the picture) so if yours is too misaligned try other values for posY on the line 8 and 50
int posY = 130;
posY = 130;
if you open the serial monitor in the Arduino IDE
you can test the camera mount sending the characters a, d, w, s
a ☩ d
and taking a few pictures typing
raspistill -v -o test.jpg
in the terminal as we learned in the last project.
Next: The target
for the target i used a few cubes for testing calibration of 3D printers that i grabbed from the recycle bin and a skewer with a few drops of instant adhesive.
you can use a small ball or a few lego cubes. the point is to try to have something that could be easy to recognize from the background...
yeah, you understand ;)
Next and final step: Control everything from Mathematica!