Coders Packet

Face detection using Open-CV -Python

By Kushagra Kinjawdekar

This is a very simple face recognition that open CV has developed. Using a pre-trained cascade file we can easily detect faces within the images. Can be easily done with Pycharm Python.

Requirements : 

1. OpenCV (pip install opencv-python)

2.Python version 2.3

Usage :

1. Unzip the downloaded folder and open Face Detection.py.

2. Change the directory for the following file haarcascade_frontalface_default.xml within the line 3.

    The file is provided within your zip.

3. If you want to load your own local image just change the path of

   img = cv2.imread("Your path here")

IMP: If your image is not in the same directory as of downloaded folder don't forget to use  "r"

for eg :   r'C:\Users\Downloads\img.jpg')

 

How to use it in your own projects:

1. If you are creating a model to recognize face/or live face reading using raspberry pie, you can implement the following file and change it according to your requirements.

2. Using a drone/webcam to recognize face during night as a security device can be created using OpenCV.

Example:

Example.

 

Download Complete Code

Comments

No comments yet