This package allows you to detect faces in real-time using a webcam and overlay an AR object above the detected face.
Project description
AR Face Overlay Package
This package allows you to detect faces in real-time using a webcam and overlay an image (sticker) above the detected face. It includes built-in system checks to ensure your hardware can run the processing smoothly.
Prerequisites: The package requires Python 3.7 or higher and the following libraries:
- opencv-python
- numpy
- psutil
they will be Installed automatically using pip:
pip install opencv-python numpy psutil
Usage:
You can start the application by importing the package in your main script (test.py for example).
import refined_augment as ar
# Run with your custom image
ar.start(image_path='AR_photo.png')
How It Works :
-
System Check: The program verifies if you have at least 2GB of RAM and 2 CPU cores to prevent lag.
-
Resource Management: It automatically searches for the haarcascade_frontalface_default.xml file. If the file is not found locally or in the OpenCV system folder, it downloads it from the official repository.
-
Perspective Warping: The program uses a homography matrix to scale and position the overlay image so it follows the movement of the face.
File Descriptions :
Diagnostics.py: Contains functions to check RAM, CPU, and camera availability. It also handles the path resolution for the Haar Cascade XML file.
Engine.py: Contains the main loop that processes video frames, detects faces, and applies the image overlay logic.
init.py: Acts as the package interface, coordinating the diagnostics and the engine.
Controls :
'q': Press the 'q' key on your keyboard to stop the video feed and close the application.
Troubleshooting Image Load Error: Ensure the image path provided in ar.start() is correct relative to where you are running the script.
Camera Error: If the camera access fails, check if another application is using the webcam.
Persistence Error: This occurs if the XML file is corrupted or missing. The program will attempt to re-download it if you delete the existing XML file in the directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file refined_augment-0.1.3-py3-none-any.whl.
File metadata
- Download URL: refined_augment-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ed4e7a6981ac09125d665a135213c5beda9c57100cfdecf6a03906190dc137c
|
|
| MD5 |
00579898907076ef23086d4cf7c9b6a0
|
|
| BLAKE2b-256 |
091f987fc0c814d4fa1fa5b5a994ecf3395ae249b2416080cfef684cbe452742
|