top of page
Search

Project 003 - Face Tracking via SimpleCV

  • Writer: Charles Barrett
    Charles Barrett
  • Nov 2, 2019
  • 1 min read

In this post I will detail the steps to take  to 'face detect '  (not the same as 'face recognition' ) using SimpleCV via an optical device ( webcam) .

Hardware:

1 ) Raspberry pi 2 ) Webcam

Steps :

1) Install SimpleCV by running the following unix commands (via Terminal on your pi) :

sudo apt-get install ipython python-opencv python-scipy python-numpy python-setuptools python-pip

sudo pip install https://github.com/sightmachine/SimpleCV/zipball/master

2) Create a python file in  the directory called  " /home/pi "  called  "facedetect.py"

3) Copy and paste the following code into the python file : from SimpleCV import Camera, Display cam = Camera() disp = Display(cam.getImage().size()) while disp.isNotDone(): img = cam.getImage() # Look for a face faces = img.findHaarFeatures('face.xml')  ## you may need to locate face.xml in the SimpleCV directories . if faces is not None: # Get the largest face faces = faces.sortArea() bigFace = faces[-1] # Draw a green box around the face bigFace.draw() img.save(disp)

​4) Once you've copied the python code and saved the file ,  run the  Code / Unix commands in the  CODE:  section of this post  to launch the software .

Code / Unix Command : 

Sudo python facedetect.py

Video Example of Software in action :




 
 
 

コメント


bottom of page