Monday, April 28, 2014

Getting face recognition to work on Raspberry Pi with Pi Cam

1. Buy a pi and a camboard module.

2. Install Raspbian.

3. Run
$ sudo raspi-config
to turn on the camera module

4. Follow the instruction here to compile and install opencv.
http://robertcastle.com/2014/02/installing-opencv-on-a-raspberry-pi/

5. Install the UV4L driver to make /dev/video0 available as a virtual device to your pi cam.
http://www.linux-projects.org/modules/sections/index.php?op=viewarticle&artid=14


6. Reconfig the U4L driver so that there is no annoying preview coming up.
$ sudo pkill uv4l
$ sudo uv4l --driver raspicam --auto-video_nr --width 640 --height 480 --encoding jpeg --nopreview

7. Download
https://github.com/berak/opencv_smallfry
8.
$ startx
$ cd opencv_smallfry
$ python facerec_online.py your_folder_to_store_training_pics /usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_default.xml
9. Enjoy!

2 comments:

Unknown said...

Part 8 says enter startx. This will destroy the passwords in Raspbian Jessie and make your SDcard unusable. I have now done this twice while following the tutorial. Back to square one.

Kenny Zhuo Ming Lu said...

@Sarah Thanks for the compliment.

@Dave, I have not tested it in Jessie. I will give it try again and let you know.