Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Real-time Face Blurring using OpenCV

This Python script utilizes OpenCV to perform real-time face detection and blurring in video streams from a webcam. It detects faces in the video frames using a pre-trained Haar Cascade classifier and applies Gaussian blur to the detected faces while keeping the rest of the frame unchanged.

Features

  • Real-time Face Detection: Detects faces in the video stream from the webcam in real-time.
  • Face Blurring: Applies Gaussian blur to the detected faces to anonymize them while preserving the rest of the frame.
  • Video Capture: Utilizes OpenCV's VideoCapture module to access the video stream from the default camera.
  • User Interaction: The script exits when the Enter key is pressed, allowing for user-controlled termination.

Installation

  1. Install OpenCV: Install OpenCV library using pip if not already installed.

    pip install opencv-python
  2. Download Haar Cascade Classifier: Ensure that you have the Haar Cascade XML file (haarcascade_frontalface_default.xml) for face detection. You can find it in the data/haarcascades directory of your OpenCV installation.

  3. Run the Script: Execute the Python script provided (face_blurring.py or any preferred filename) using a Python interpreter.

    python face_blurring.py
  4. Terminate the Script: Press the Enter key to exit the script and close the video stream window.

Dependencies

  • OpenCV: Open Source Computer Vision Library for image and video processing.

Notes

  • You may need to adjust the parameters of the detectMultiScale function (e.g., scaleFactor, minNeighbors, minSize) based on the environmental conditions for optimal face detection performance.
  • Ensure that your webcam is correctly configured and accessible by OpenCV.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages