Skip to content

musagithub1/FACE_DETECTION_PROJECT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Enhanced Face Analysis Tool

Python Version OpenCV Platform License

πŸš€ A comprehensive face analysis tool with AI-powered features

Built with OpenCV and Python for advanced computer vision applications


✨ Features

🎯 Core Detection

  • Face Detection - Real-time face detection in images/video
  • Age & Gender Prediction - AI-powered demographic analysis
  • Emotion Recognition - Happy/neutral emotion detection
  • Smile Analysis - Intensity classification (Slight/Moderate/Broad)

🎨 Advanced Analysis

  • Head Pose Estimation - Direction and tilt analysis
  • Face Shape Classification - Oval, round, square detection
  • Glasses Detection - Automated eyewear identification
  • Facial Symmetry - Percentage-based symmetry scoring

πŸ› οΈ Processing Tools

  • Image Filters - Sepia, B&W, Cartoon effects
  • Face Tracking - Video trajectory visualization
  • Orientation Correction - Auto-alignment features
  • Privacy Blurring - Face anonymization

πŸ“Š Utilities

  • Batch Processing - Multiple image handling
  • Face Measurements - Dimensional analysis
  • GUI Interface - User-friendly Tkinter interface
  • CLI Support - Full command-line functionality

πŸ“ Project Structure

FACE_DETECTION_PROJECT/
β”œβ”€β”€ πŸ“‚ data/                    # Haarcascade XML files
β”œβ”€β”€ πŸ“‚ models/                  # Trained/saved AI models
β”œβ”€β”€ πŸ“‚ samples/                 # Sample images/videos
β”œβ”€β”€ πŸ“‚ src/                     # Python source code
β”‚   β”œβ”€β”€ 🐍 face_detection.py
β”‚   β”œβ”€β”€ 🐍 simplified_face_detection.py
β”‚   β”œβ”€β”€ 🐍 enhanced_face_detection.py
β”‚   β”œβ”€β”€ 🐍 enhanced_face_detection_emotion.py
β”‚   └── 🐍 face_analyzer.py    # Main application
β”œβ”€β”€ 🐍 get_xml_files.py
β”œβ”€β”€ πŸ“‹ requirements.txt
β”œβ”€β”€ πŸ“– README.md
└── 🚫 .gitignore

πŸš€ Quick Start

Prerequisites

Python OpenCV NumPy

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/face-analysis-tool.git
    cd face-analysis-tool
  2. Install dependencies

    pip install opencv-python numpy pillow
  3. Optional GUI dependencies (Ubuntu/Debian)

    sudo apt-get install python3-tk

πŸ’» Usage Guide

πŸ–₯️ GUI Mode (Recommended)

GUI Mode
python src/face_analyzer.py --mode gui

Features:

  • πŸ–±οΈ Point-and-click interface
  • πŸ“‚ Easy file loading
  • πŸŽ₯ Webcam integration
  • βš™οΈ Real-time settings adjustment
  • πŸ’Ύ One-click save functionality

πŸ“· Image Processing

python src/face_analyzer.py --mode image --input <image_path> [options]

Example:

python src/face_analyzer.py --mode image \
  --input samples/portrait.jpg \
  --output samples/analyzed_portrait.jpg \
  --filter cartoon --recognize --orient

πŸŽ₯ Video Processing

python src/face_analyzer.py --mode video [options]

Example:

python src/face_analyzer.py --mode video --blur --track

πŸ’‘ Tip: Press q in the video window to quit

πŸ“ Batch Processing

python src/face_analyzer.py --mode batch \
  --input <input_directory> \
  --output <output_directory> [options]

Example:

python src/face_analyzer.py --mode batch \
  --input samples/ \
  --output processed_batch/ \
  --filter sepia --blur

βš™οΈ Configuration Options

πŸ”§ Command Line Arguments
Option Values Description
--mode gui, image, video, batch Processing mode
--input <path> Input file/directory path
--output <path> Output file/directory path
--video_source <index> Webcam index (default: 0)
--filter none, sepia, bw, cartoon Image filter type
--blur - Enable face blurring
--recognize - Enable face recognition
--track - Enable face tracking
--orient - Auto-correct orientation
--data-dir <path> Custom Haar cascade path
--models-dir <path> Custom models directory

πŸ› οΈ Troubleshooting

🚨 Common Issues & Solutions

GUI Not Available

⚠️ Warning: Tkinter/Pillow not found

Solution: Install GUI dependencies or use CLI modes

pip install pillow
# Ubuntu/Debian:
sudo apt-get install python3-tk

Missing Cascade Files

❌ Error: Cascade/Model not found

Solution: Verify file paths or use custom directories

python src/face_analyzer.py --data-dir /custom/path --models-dir /model/path

Webcam Issues

❌ Error: Cannot access camera

Solutions:

  • Check camera connections and drivers
  • Try different video source index: --video_source 1
  • Verify camera permissions

Slow Performance

⏳ Slow tracking performance

Solutions:

  • Switch to KCF tracker (modify code)
  • Reduce video resolution
  • Close unnecessary applications

🀝 Contributing

PRs Welcome GitHub issues GitHub stars

We welcome contributions! Please see our Contributing Guidelines for details.

Development Setup

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes and test thoroughly
  4. Submit a pull request with detailed description

πŸ“Š Performance & Compatibility

Platform Status Python Versions
πŸͺŸ Windows βœ… Fully Supported 3.7+
🐧 Linux βœ… Fully Supported 3.7+
🍎 macOS βœ… Fully Supported 3.7+

πŸ“„ License

License

This project is provided for educational purposes only. Please respect privacy and ethical guidelines when using face analysis technology.


⭐ If you found this project helpful, please give it a star! ⭐

🏠 Home β€’ πŸ“‹ Features β€’ πŸ’Ώ Install β€’ πŸ“– Docs β€’ 🀝 Contribute

Built with ❀️ for the computer vision community

About

Face Detection and Analysis project using OpenCV, MediaPipe, and DeepFace (includes Haar cascades, emotion recognition, and face analysis).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages