Skip to content
dragonscypherPublic

About

A VTO

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

Tryspec

A webcam virtual try-on for glasses and hats, written in Python.

How it works

MediaPipe Face Mesh finds facial landmarks each frame. The distance between landmarks sets the size of the accessory, its position follows the face, and the PNG (with transparency) is blended onto the frame with OpenCV.

Files

  • test.py: the core: loads the accessory images, runs face mesh, scales and positions the overlay.
  • ui,py: the PyQt5 front end that shows the camera view and switches accessories (the filename has a typo from when I created it).

Controls

In the OpenCV view: g cycles glasses, h cycles hats, q quits.

Running it

pip install opencv-python mediapipe numpy PyQt5
python test.py

You need your own transparent PNGs named in the glasses_paths and hats_paths lists at the top of test.py. They are not included.

Ideas I have not done

More accessory types, and recommending styles based on face shape.

About

A VTO

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages