ForeheadTracker Pro is a high-performance, modular facial landmark tracking system designed for real-time targeting and tactical HUD overlays. Leveraging the modern MediaPipe Tasks API and OpenCV, it provides surgical precision and cinematic visual feedback.
- Surgical Precision: Tracks 478 landmarks with sub-pixel accuracy.
- Tactical HUD: Minimalist, AR-headset inspired UI with cyan and white aesthetics.
- Intelligent Centering: Targets the true face center (Eyes-Nose-Chin average) for stable tracking.
-
Advanced Smoothing: Integrated Exponential Moving Average (EMA) filtering (
$\alpha=0.15$ ) for fluid, cinematic motion. - Multi-Target Lock: Concurrently tracks and locks onto up to 5 faces.
-
Visual Feedback:
- Pulsing Reticle: Animated cyan reticle with rotating outer rings.
- Corner Brackets: Dynamic L-shaped brackets for facial containment.
- Telemetry: Real-time FPS monitoring and tracking status HUD.
- Multi-Source Input: Supports live webcam, local video files, and static images.
-
Clone the repository:
git clone https://github.com/yourusername/ForeheadTracker-Pro.git cd ForeheadTracker-Pro -
Install dependencies:
pip install -r requirements.txt
-
Ensure the model is present: The system will look for
assets/face_landmarker.task. (Automatically downloaded if missing).
python src/main.pypython src/main.py --input path/to/video.mp4python src/main.py --input path/to/photo.jpgForeheadTracker-Pro/
├── assets/ # Model files and demo assets
├── src/
│ ├── main.py # Entry point & CLI handling
│ ├── detector.py # MediaPipe Tasks API integration
│ ├── tracker.py # Smoothing & targeting logic
│ └── utils.py # Tactical HUD drawing engine
├── requirements.txt # Project dependencies
└── LICENSE # MIT License
- Detection: Uses
mediapipe.tasks.visionto extract high-density face meshes. - Targeting: Calculates the geometric center of the face using a weighted average of the nose bridge and facial perimeter.
- Stabilization: Applies an EMA filter to the coordinates to eliminate camera jitter and micro-movements.
- Rendering: Draw surgical-grade UI elements using OpenCV's core drawing functions with alpha-blending for the "glow" effect.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Feel free to open an issue or submit a pull request.
Developed with ❤️ by jalalakbar47
Dedicated to my 💖 JS. 💖