Skip to content

Lakshya-kt/BlurFacePro

Repository files navigation

BlurFacePro

Efficient video face anonymizer with multi-face support, blur/pixelate modes, and persistent anonymization. Perfect for privacy protection in videos.

Why BlurFacePro?

In today’s digital age, videos often contain identifiable faces that require privacy protection. BlurFacePro was created to provide accurate and efficient face anonymization using modern, lightweight face detection.

  1. Privacy Preservation
    Automatically anonymizes faces in videos to prevent identity exposure.
  2. Efficient YuNet-Based Detection
    Uses YuNet, a fast CNN-based face detector optimized for real-time applications, enabling reliable face detection even in multi-face scenarios.
  3. Performance-Aware Tracking Pipeline
    Combines periodic face detection with tracking to reduce computational load and maintain higher FPS during video processing.
  4. End-to-End Video Processing
    Supports full video input-to-output workflows with stable anonymization across frames.

Features

  • Multi-Face Detection: Detects multiple faces in videos using YuNet, a fast CNN-based face detector from OpenCV.
  • Tracker-Assisted Processing: Uses lightweight tracking to propagate face locations across frames and reduce repeated detections.
  • Persistent Anonymization: Faces remain anonymized even during motion.
  • Mode Toggle: Switch anonymization modes while the video is running:
    • B → Blur
    • P → Pixelate
    • N → None
  • FPS Display: Shows real-time processing speed.
  • Video Input/Output: Processes input videos and saves anonymized output videos.

Demo

Original
Blurred

Technical Overview

BlurFacePro uses a hybrid detection–tracking pipeline for efficient face anonymization:

  • Face Detection:
    Uses YuNet, a lightweight CNN-based face detector provided by OpenCV.
    YuNet is optimized for real-time performance and supports reliable multi-face detection.

  • Tracking:
    Uses the KCF (Kernelized Correlation Filter) tracker to track detected faces across frames.
    KCF offers a good balance between speed and robustness, allowing face regions to be propagated without running detection on every frame.

  • Anonymization:
    Region-based image processing (blur) is applied only to detected or tracked face regions, ensuring stable anonymization during motion.

This architecture balances accuracy (YuNet detection) and performance (KCF-based tracking).

Performance Notes

BlurFacePro is designed to balance accuracy and efficiency for practical video anonymization tasks.

  • Face detection is performed periodically using YuNet.
  • KCF tracking is used to maintain face regions across frames.
  • This approach avoids redundant detections while keeping anonymization stable.

The system is suitable for offline and near real-time video processing scenarios.

Installation

  1. Clone the repository
git clone https://github.com/Lakshya-kt/BlurFacePro.git
  1. Install dependencies:
pip install -r requirements.txt

Ensure the models/ folder contains:

  • face_detection_yunet_2023mar.onnx — YuNet face detection model

Usage

  1. Prepare the input video

    • Place the video you want to anonymize inside the project directory
      (or provide its full path)
  2. Run the program

python main.py

The anonymized video is saved as output_blur.mp4.

Future Improvements

  • Identity-aware tracking to maintain consistent face IDs across long videos.
  • Adaptive detection intervals based on scene motion or tracker confidence.
  • Improved handling of occlusions and fast motion.
  • Optional GPU acceleration for large or high-resolution videos.

License

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

About

Efficient video face anonymizer with blur and pixelation modes for privacy protection.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages