Skip to content

about40kills/RealTimeFaceBlurring

Repository files navigation

RealTimeFaceBlurring

This project provides a real-time face blurring (and pixelation) tool using your webcam. It uses OpenCV’s deep learning face detector and a tracker for smooth, fast face anonymization.

Features

  • Real-time webcam feed
  • Face detection using OpenCV DNN (SSD Caffe model)
  • Face tracking for performance
  • Two anonymization modes:
    • Blur (default)
    • Pixelate (press p to switch)
  • Switch modes on the fly (b for blur, p for pixelate)
  • Mirror image display (like a selfie camera)

Requirements

  • Python 3.x
  • OpenCV (with contrib modules)
  • Webcam

Setup

  1. Install dependencies:

    pip install opencv-contrib-python
  2. Download the face detection model files:

  3. Run the script:

    python face_blur.py

Usage

  • The webcam window will open and display a mirrored video feed.
  • Detected faces will be blurred (default) or pixelated.
  • Press b to switch to blur mode.
  • Press p to switch to pixelate mode.
  • Press q to quit.

How it works

  • Uses a DNN model to detect faces in the webcam feed.
  • Initializes a tracker on the detected face for smooth, fast updates.
  • Applies either a blur or pixelation effect to the face region.
  • Overlays the processed face back onto the video frame.
  • Displays the result in real time.

Notes

  • The script uses OpenCV’s legacy tracker API. If you get errors, ensure you have opencv-contrib-python installed.
  • For best results, use in a well-lit environment.

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages