Yesterday, we were playing around with Arduino again. This time Javier and me went to bigger project. A led that turns on when the computer detects a face with the webcam. After solving issues with the Internet connection we divided the work. He went into the task of manipulating the Arduino from Processing and I install the opencv and the respective libraries for processing.
Here are the steps:
1. Install processing. Just download, uncompress and run.
2. Install opencv. Just open Terminal and execute the next command
sudo apt-get install libcv2.1 libcvaux2.1 libhighgui2.1
3. Find the sketchbook folder. To find the Processing sketchbook location on your computer, open the Preferences window from the Processing application and look for the "Sketchbook location" item at the top. So, for example, my sketchbook was located in /home/roberto/sketches.
4. Find or create the libraries folder. Inside the sketchbook folder (/home/roberto/sketches) there should be another folder called libraries. If you don't find it, just create it.
6. Uncompress the tar.gz
7. Copy the whole uncompressed folder into the libraries folder. In my case /home/roberto/sketches/libraries. Normally the installation finish here, however it does not work because some of the files are named differently (different version of opencv)
8. Open a Terminal an create the following symbolic links with these commands:
sudo ln -s /usr/lib/libcxcore.so /usr/lib/libcxcore.so.1 sudo ln -s /usr/lib/libcv.so /usr/lib/libcv.so.1 sudo ln -s /usr/lib/libcvaux.so /usr/lib/libcvaux.so.1 sudo ln -s /usr/lib/libml.so /usr/lib/libml.so.1 sudo ln -s /usr/lib/libhighgui.so.2.1 /usr/lib/libhighgui.so.1
9. Open processing and paste the code. Just past this code in the processing window.
10. A small change in the previous code. Just change this line
opencv.cascade( OpenCV.CASCADE_FRONTALFACE_ALT ); // load the FRONTALFACE description file
for this one
opencv.cascade( "/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml" ); // load the FRONTALFACE description file
Actually, I found more than one file. So it probably worth these others files. I just went to try them! The second one is much faster.
/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt2.xml /usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt_tree.xml /usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_default.xml /usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml
11. Run the code and enjoy.
It's amazing how easily you can run very cool libraries to let your imagination fly. Don't miss Javier's blog who is going to post about the whole mini-project with Arduino included during this week.