Face Detection Using Python
by Anvith293 in Circuits > Raspberry Pi
497 Views, 5 Favorites, 0 Comments
Face Detection Using Python
Hey everyone, My name is Anvith and this Instructable is about ' How to make a face detection code using Python with the help of OpenCV '. This is a step by step process of How to make the code and this Instructable also includes How to install Pip.
The items needed are :-
- A laptop or a PC
- Python software ( Includes IDLE, Manuals and Module Docs )
- Command prompt or terminal
Installation of Pip
Pip is a package-management system written in Python used to install and manage software packages.
For the code we will be working on, we need to install packages and that is only possible with pip
Firstly, we need to go to this website : https://bootstrap.pypa.io/get-pip.py Once we have visited this website, we need to right click on the screen and select the 'Save As' option in the pop up menu. We can name the python file 'get-pip'. Remember to save the python file in the same area where python is saved. Once we have saved this file, we can open Command Prompt and type this command : python get-pip.py and pip is successfully installed in your computer.
We can verify by running the command : pip -V
Installation of OpenCV
OpenCV is a Python open-source library, which is used for computer vision in Artificial intelligence, Machine Learning, face recognition, etc.
To detect our faces, OpenCV in needed. The installation process for OpenCV is very easy.
To install, we need to open command prompt and enter the command : pip install opencv-python.
That's it for installing opencv.
Installation of Numpy
NumPy is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays.
To install NumPy, we have to open the command prompt and enter the command : pip install numpy
Face Detection Code
We need to create a new folder for storing the haarcascade and python file.
The face will be detected in a green frame
Face Detection With Eye Detection and Mouth Detection Code
We can use another haarcascade to detect the eye and another haarcascade to detect the mouth and store both haarcascades and python file in one folder.
The python file attached includes the face mouth and eye detection.
All Sources
Hey everyone
Thank you for viewing this instructable
attached below are all the python files
THANK YOU AGAIN AND HAPPY LEARNING