Face Detection Using Python and OpenCV Library





Introduction: Face Detection Using Python and OpenCV Library

This project will use the OpenCV library and python to facilitate face detection

Step 1: What You Need

1. An Intel Edison Development Board

2. A webcam, we will use the Light Wave LW-IC500

3. Python and the openCV library installed on your machine

Step 2: Setting Up

The Intel Edison board has an inbuilt USB port, through which you can connect your webcam. This will provide power and get images from the camera.

Also, connect the Edison to your computer through the provided USB Cable in order to upload programs. Make sure your putty is running well, and is connected to the board

Step 3: Your Code:

import numpy
import cv2 import urllib print("Downloading Images and Necessary Files") urllib.urlretrieve('http://cdn.makezine.com/make/43/Intel_CES_Team.png', '/usr/lib/edison_config_tools/public/in.jpg') urllib.urlretrieve('https://raw.githubusercontent.com/Itseez/opencv/master/data/haarcascades/haarcascade_frontalface_alt.xml', '/usr/lib/edison_config_tools/public/haarcascade_frontalface_alt.xml') img = cv2.imread('/usr/lib/edison_config_tools/public/in.jpg') gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) faceCascade = cv2.CascadeClassifier('haarcascade_frontalface_alt.xml') faces = faceCascade.detectMultiScale(gray,scaleFactor=1.1,minNeighbors=5,minSize=(30, 30), flags = cv2.cv.CV_HAAR_SCALE_IMAGE) for (x,y,w,h) in faces: cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2) cv2.imwrite('in_face_found.png',img)

Step 4: Try It Out

Log on to your html page and check the results out



  • Epilog Challenge 9

    Epilog Challenge 9
  • First Time Author Contest 2018

    First Time Author Contest 2018
  • Paper Contest 2018

    Paper Contest 2018

We have a be nice policy.
Please be positive and constructive.




hello sir ^^
please do you have the algorithim of object track by python ??

Very interesting, thanks!

Would you use a face detection feature like this for security purposes, or for something else?