Skip to content

Nciibi/live-face-blur

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎭 Face Anonymizer for Video Calls

Real-time face anonymization tool for privacy-conscious video conferencing

License C++ OpenCV Platform


πŸ“– Overview

Face Anonymizer is a real-time face detection and blurring application designed for video conferencing platforms like Zoom, Microsoft Teams, Discord, and more. It captures video from your webcam, detects faces using advanced AI models, applies customizable blur effects, and outputs the anonymized video stream to a virtual camera device that any video call application can use.

✨ Key Features

  • 🎯 Real-time Face Detection - Powered by YuNet (OpenCV) for accurate face detection
  • 🎨 Modern GUI - Beautiful, intuitive interface with live preview and controls
  • 🎚️ Adjustable Blur Intensity - Control blur density from 0-100% with an interactive slider
  • πŸ“Ή Virtual Camera Output - Seamless integration with Zoom, Teams, Discord, and other video apps
  • ⚑ Low Latency - Optimized for real-time video processing
  • πŸ“Š Live Statistics - Real-time FPS counter and face detection count
  • 🎭 Elliptical Blur - Natural-looking anonymization that preserves video quality
  • πŸ–±οΈ Interactive Controls - Click-and-drag slider for instant blur adjustment

πŸ–ΌοΈ Screenshots

Note: Add screenshots of your GUI here to showcase the interface

[Preview Window]          [Control Panel]
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 β”‚      β”‚ Blur: 75%    β”‚
β”‚  [Video Feed]   β”‚      β”‚ ━━━━━━━━━━  β”‚
β”‚                 β”‚      β”‚              β”‚
β”‚  Blur: 75%      β”‚      β”‚ Faces: 1     β”‚
β”‚  Faces: 1       β”‚      β”‚ FPS: 30.0   β”‚
β”‚  FPS: 30.0      β”‚      β”‚              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites

  • Linux (Ubuntu/Debian, Arch, Fedora, or similar)
  • OpenCV 4.x with face detection support
  • CMake 3.10+
  • C++17 compatible compiler (GCC/Clang)
  • ffmpeg (for virtual camera output)
  • v4l2loopback kernel module

Installation

1. Install Dependencies

Ubuntu/Debian:

sudo apt-get update
sudo apt-get install build-essential cmake libopencv-dev ffmpeg v4l2loopback-dkms

Arch Linux:

sudo pacman -S base-devel cmake opencv ffmpeg v4l2loopback-dkms

Fedora:

sudo dnf install gcc-c++ cmake opencv-devel ffmpeg v4l2loopback

2. Download Face Detection Model

mkdir -p assets
cd assets
wget https://github.com/opencv/opencv_zoo/raw/master/models/face_detection_yunet/face_detection_yunet_2023mar.onnx
cd ..

3. Build the Project

mkdir -p build
cd build
cmake ..
make

4. Set Up Virtual Camera

# Run the setup script
sudo ./setup_virtual_camera.sh

# Or manually load the kernel module
sudo modprobe v4l2loopback devices=1 video_nr=2 card_label="FaceAnonymizer" exclusive_caps=1

Make it persistent across reboots:

echo "v4l2loopback" | sudo tee /etc/modules-load.d/v4l2loopback.conf
echo "options v4l2loopback devices=1 video_nr=2 card_label=\"FaceAnonymizer\" exclusive_caps=1" | sudo tee /etc/modprobe.d/v4l2loopback.conf

πŸ’» Usage

Basic Usage

./build/LiveFaceAnonymizer

Command Line Options

./build/LiveFaceAnonymizer [options]

Options:
  --camera <index>     Camera index (default: 0)
  --device <path>      Virtual camera device path (default: auto-detect)
  --no-preview         Disable preview window
  --help, -h           Show help message

Examples

Use a different camera:

./build/LiveFaceAnonymizer --camera 1

Specify virtual camera device:

./build/LiveFaceAnonymizer --device /dev/video3

Run without GUI (headless mode):

./build/LiveFaceAnonymizer --no-preview

πŸŽ₯ Using with Video Conferencing Apps

Zoom / Microsoft Teams / Discord

  1. Start Face Anonymizer:

    ./build/LiveFaceAnonymizer
  2. Adjust Blur Intensity:

    • Use the interactive slider in the control panel
    • Click and drag to adjust blur density (0-100%)
    • Changes apply instantly to the preview
  3. Select Virtual Camera:

    • Open your video conferencing app
    • Go to Settings β†’ Video (or Camera settings)
    • Select "FaceAnonymizer" or "/dev/video2" from the camera list
  4. Start Your Call:

    • Your face will be automatically anonymized in real-time! 🎭

GUI Overview

The application features a modern, unified interface:

  • Preview Area (70%) - Large video feed showing anonymized output

    • Live statistics overlay (blur %, face count, FPS)
    • Real-time face detection visualization
  • Control Panel (30%) - Interactive controls and information

    • Blur intensity slider with visual feedback
    • Face detection statistics
    • FPS counter
    • Virtual camera status indicator
    • Usage instructions

πŸ—οΈ Project Structure

deepfaker/
β”œβ”€β”€ CMakeLists.txt          # Build configuration
β”œβ”€β”€ README.md               # This file
β”œβ”€β”€ QUICKSTART.md          # Quick start guide
β”œβ”€β”€ setup_virtual_camera.sh # Virtual camera setup script
β”œβ”€β”€ assets/                 # Model files directory
β”‚   └── face_detection_yunet_2023mar.onnx
β”œβ”€β”€ src/                    # Source code
β”‚   β”œβ”€β”€ main.cpp           # Main application entry point
β”‚   β”œβ”€β”€ FaceAnonymizer.hpp # Face detection and blurring class
β”‚   β”œβ”€β”€ FaceAnonymizer.cpp
β”‚   β”œβ”€β”€ VirtualCamera.hpp  # Virtual camera output handler
β”‚   β”œβ”€β”€ VirtualCamera.cpp
β”‚   β”œβ”€β”€ ModernGUI.hpp      # Modern GUI interface
β”‚   └── ModernGUI.cpp
└── build/                 # Build directory (generated)
    └── LiveFaceAnonymizer # Compiled executable

πŸ”§ How It Works

  1. Capture - Reads video frames from your webcam using OpenCV
  2. Detect - Uses YuNet face detection model to identify faces in real-time
  3. Anonymize - Applies elliptical Gaussian blur to detected face regions
  4. Output - Streams anonymized frames to virtual camera via ffmpeg
  5. Display - Shows preview window with live statistics (optional)

The virtual camera device (/dev/video2) appears as a standard camera to video applications, enabling seamless integration without additional plugins or software.

πŸ› Troubleshooting

Virtual Camera Not Found

# Check if module is loaded
lsmod | grep v4l2loopback

# Check if device exists
ls -l /dev/video*

# Reload the module
sudo modprobe -r v4l2loopback
sudo modprobe v4l2loopback devices=1 video_nr=2

Camera Not Opening

# List available cameras
v4l2-ctl --list-devices

# Try a different camera index
./build/LiveFaceAnonymizer --camera 1

Permission Denied for /dev/video*

# Add user to video group
sudo usermod -a -G video $USER

# Log out and log back in for changes to take effect

Low Frame Rate / Performance Issues

  • Close other applications using the camera
  • Reduce camera resolution (modify width/height in main.cpp)
  • Check CPU usage - face detection can be CPU intensive
  • Ensure you're using hardware-accelerated OpenCV if available

ffmpeg Not Found

# Install ffmpeg
sudo apt-get install ffmpeg  # Ubuntu/Debian
sudo pacman -S ffmpeg         # Arch
sudo dnf install ffmpeg       # Fedora

πŸ› οΈ Development

Building from Source

git clone <your-repo-url>
cd deepfaker
mkdir build && cd build
cmake ..
make

Dependencies

  • OpenCV 4.x - Computer vision library
  • CMake 3.10+ - Build system
  • C++17 - Programming language standard
  • ffmpeg - Video streaming
  • v4l2loopback - Virtual video device

Code Structure

  • FaceAnonymizer - Handles face detection and blurring
  • VirtualCamera - Manages virtual camera output via ffmpeg
  • ModernGUI - Provides modern user interface

πŸ“ License

This project uses OpenCV and the YuNet face detection model. Please refer to their respective licenses:

  • OpenCV - Apache 2.0 License
  • YuNet Model - Apache 2.0 License (from OpenCV Zoo)

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ™ Acknowledgments

πŸ“§ Contact & Support


Made with ❀️ for privacy-conscious video conferencing

⭐ Star this repo if you find it useful!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors