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 AI_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 Distribution

refined_augment-0.1.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

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

refined_augment-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file refined_augment-0.1.0.tar.gz.

File metadata

  • Download URL: refined_augment-0.1.0.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for refined_augment-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c812f0ae432a8119bfc2ea560164f0d687eb7083fda3fbaca9693db298ad915c
MD5 4f40b0996d59d83193bf3f894194cf10
BLAKE2b-256 f649543645c401a5216c397550f3ffbdb352fb7bb6cfba7da580ef0a026d1d5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for refined_augment-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4c441dcf1d1c8697a847c580e7421271b3bd3fc058e573ad2f6b1d6f129b65a
MD5 f58ccf85daaeeeb010bc119c68934be8
BLAKE2b-256 c7483eb0097e4e29a52e1433bda7a9316a097bf9bbb7a9a5851882aaa83a2e8d

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