Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

refined_augment-0.1.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file refined_augment-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for refined_augment-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 19012e7f35292d740d06e19ac16c87493c387e6c460ee2a140d549439e743986
MD5 f0752f42e26cba5d1c3b2fb8fb912610
BLAKE2b-256 dda6f55aa94a2dd71edf0b4a3ef22e00cab9c2e303b213150acf94d93a28d30a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page