loading

This instructable will teach you everything you need to know about installing your new RasPi Camera to your Raspberry Pi and implement OpenCV's Face tracking libraries. The tutorial will not assume that you know how to program or understand the inner workings of a Raspberry Pi. Intermediate users can easily use the tutorial. Beginners should be able to use this tutorial but may run into problems along the way. The time to complete is approximately 10hrs due to the slow processing power of the Raspberry Pi and the size of OpenCV. It will be easier if you use a usb webcam to start out then go back and install the necessary libraries for the Raspi Camera. By the end of the tutorial you will have a fully functioning OpenCV installation on your Raspberry Pi capable of face tracking and much much more.

Materials Needed

  • Raspberry Pi
  • SD Card
  • RasPi Camera Module
  • Keyboard
  • Mouse
  • Micro USB Charger
  • Ethernet cord
  • HDMI cord
  • Monitor

Step 1: Install Operating System to SD Card

Download OS Image - raspberrypi.org/downloads

Installation Guides

<p>You can do it without recompiling OCV (so saving several hours): </p><p><a href="http://rpihome.blogspot.com/2015/03/face-detection-with-raspberry-pi.html" rel="nofollow">http://rpihome.blogspot.com/2015/03/face-detection-with-raspberry-pi.html</a></p><p>Anyway this is a really nice tutorial!</p>
<p>This approach would definitely save plenty of time. Have you noticed any problems using the PiCamera? I was unable to grab the stream directly since OpenCV was expecting a usb device not a CSI one.</p><p>SimpleCV is also a great alternative. </p><p>Both approaches are great if you want to use python.</p>
<p>I featured your comment, great suggestion!</p>
<p>Thanks! </p>
<p>I used this method since few days and found no problems right now. Anyway I'm just using it for single images as I need to take just an image every 1/2 second or more, so I do not used a video stream.</p><p>It could be also used with a video stream, but it would be more complex and probably recompiling would be better (less cpu load when acquiring the frames).</p>
<p>This is awesome! I've never done anything like this before. I think that I will look into this more when I have time! </p>
<p>I am glad you like it! </p><p>A few tips: </p><p>Run make -j4 without the gui it will run faster and will not go into power save mode every couple of minutes.</p><p>You can use a standard usb camera just by compiling OpenCV, many of my steps are geared towards RasPi Camera users.</p><p>Compilation took me 10hrs on the original Raspberry Pi, its a grueling process no way around it. It should take under 5hrs to complete on a newer model.</p><p>A slight overclock will cut down the time it takes to compile but be wary this makes kernal panics and errors more likely to happen. </p><p>Make sure you have at least 2gb in your installation directory, there is nothing more frustrating than having to start all over with a new SD card.</p><p>You may email me at bytefoolish@gmail.com if you have any questions.</p><p>I look forward to seeing what you come up with!</p>
<p>are you serious about the 5-10 hours thing??</p>
<p>From what I've read on OpenCV, it seems for face recognition, it's necessary to capture positive and negative images...</p><p>But, do you know if generating synthetic positive images from actual (positive) images using opencv_createsamples is necessary when not using the Haar algorithm.. like LBP, eigenface, fisherface?</p><p>For example, this tutorial creates new positive images by placing inside negative images: </p><p><a href="http://www.memememememememe.me/training-haar-cascades/" rel="nofollow">http://www.memememememememe.me/training-haar-casca...</a></p><p>By contrast, this example, only uses FaceRecognition class, and does not use opencv_createsamples</p><p><a href="http://nates.space/2016/01/13/face-recognition-with-opencv-on-raspberry-pi-c/" rel="nofollow">http://nates.space/2016/01/13/face-recognition-wit...</a><br></p><p>Any thoughts on this?</p>
<p>İt's a very nice tutorial thank you a lot. But I got a problem, why does it say &quot;command not found&quot; for 6 and 7 which is ..bashrc ve mkvirtualenv?</p>
<p>Hi , nice tuturial!<br>But do u have problems whit low rate FPS ?<br>Im doing someting whit openCV libs in C++ for a University Project and i cant get a good fps Rate.. can u help me? </p>
<p>Hi Bytefoolish, I am about to work though this tutorial and I wanted to ask which OS Image would be best to install, or does it not really matter? As a newbie I am thinking that NOOBS might be best. Also I have bought a Raspberry Pi but it is a R-Pi 2; will this make any difference when going through this tutorial? Your comment's would be most welcome. Thanks.</p>
<p>May 2016. If anyone else is looking to install NOOBS (Raspian Jessie) and OpenCV on a Raspberry Pi 2 Model B (UK), then this is the guide that worked for me; it also has extensive guides and tutorials on OpenCV: http://www.pyimagesearch.com/2015/10/26/how-to-install-opencv-3-on-raspbian-jessie/</p>

About This Instructable

160,191views

133favorites

License:

More by bytefoolish:RasPi + OpenCV = Face Tracking 
Add instructable to: