Our wonderful robot designed by Tordal and animated with my soft running on a raspberry pi was exposed at the Museum for Contemporary Art MARCO in Mexico from september 2014 to January 2015. RPi Power ! 😀
This painting was exhibited in Berlin during Pictoplasma 2014 Festival.
Eyes are following visitors (if many, change randomly).
It’s powered by a Raspberry Pi, C++ Code and Open CV (using Face Recognition)
Technical Stuff – Face Recognition
Software is based on Raspberry Pi and strongly inspired from my previous “OpenCV and Pi camera” posts.
For face recognition, software is very easy : it only detects faces, without recognizing people. It’s fast.
face_cascade.detectMultiScale(imageMat, faces, 1.1,3,CV_HAAR_SCALE_IMAGE,Size(80,80));
g_nVisitors = faces.size(); // number of visitors found
Once faces are detected, instructions are sent to servos to move eyes. Actually, it looks like a physical version of XEyes, for old good X11 geeks 😉
The code implements a lot of funny behaviors :
- if unique visitor, follow him
- if many visitors, randomly change
- if a new visitor appears, focus on him
- if nobody, search visitors with funny eyes moves
- sometimes, take a nap, close eyelids.
The tricky part was how to remember which visitor is where, frame after frame. And, when the face is lost while few seconds, be able to remember this visitor was already here (it’s not a new one, no need to focus on him/her).
Technical Stuff – Servo Control
Eyes are controlled by 2 servos (horizontal and vertical moves). Eyelid is controlled by a third servo. Thanks to ServoBlaster, control servos with Raspberry Pi is really very easy. To move servo using shell (for testing), just type : (0 = 1st servo, % = between 0-100)
echo 0=50% >/dev/servoblaster
echo 0=10% >/dev/servoblaster
and in C++ (fflush is important !)
FILE * servoDev;
fprintf(servoDev, “%d=%d%%\n”,ServoId,ServoPosition); //will be in a function
fflush(servoDev); // will be in a function
I used :
- Servo 0 (Horizontal Move) = GPIO 4 = Pin 7
- Servo 1 (Vertical Move) = GPIO 17 = Pin 11
- Servo 2 (Eyelid Move) = GPIO 18 = Pin 12
- GND pin is connected to gnd servo power
Thank you Bard (from 3753% Tordal) to give me opportunity to work on such funny project ! and to show our work during Pictoplasma Festival in Berlin ! (Next : Mexico…)
Thank you Richard for your wonderful and easy-to-work-with ServoBlaster Daemon.
And Thank you Nat for your patience during all these sundays, spent in front of my Raspberry… 🙂