This project aims to Blur the person's Face in Realtime and is able to detect multiple faces and blur it. Gaussian Blur is used to Blur the coloured Image and detectMultiScale is used to detect Multiple Faces. Haar Cascade classifiers are used and is an effective way for object and Face detection.
If you dont have Python installed in your PC ,it can be installed from here python.
Hit the command in CMD/Terminal if you don't have it already installed:
pip install opencv-python
(OR)
Install OpenCV via anaconda
conda install -c menpo opencv
Clone the Repository and extract the files
- Go to the folder where .py file is present
- Type cmd in the file path
- Run the code with command
python realtime_face_blur.py
- Press Q to exit the window
- This can also done without running the code by just clicking
realtime_face_blur.exe
present inrealtime_face_blur
folder. - Ensure that
haarcascade_frontalface_default.xml
is in the same working directory
-
Fisrt, We get the last recorded Frame and transform the color to grayscale
-
The haar cascade method is used to detect faces in each frame of the webcam feed.
-
We get the location of face with help of Coordinates.
-
The GaussianBlur method is used to Blur the colored image in the area where the face is found.
-
Then ROI is inserted back into the image and blurred image is returned.