This projects main goal is to have a simple library to project information into faces while retaining the facial structure.
Project description
face-projection
This projects main goal is to have a simple library to project information into faces while retaining the facial structure.
Description
Using the Canonical Face Model provided by Google, we can draw any UV map inside the given boundaries to the face.
This allows us to visualize certain properties of facial features.
The user can provide face_data
which then projected onto the face_img
.
We support automatic face detection with landmark extraction using mediapipe
.
However, the user can also provide the landmarks manually if they are already known and fit the Canonical Face Model.
Installation
MacOS
To use meshpy a C++ compiler is required. On MacOS you can use xcodebuild which is installed by default. To enable it please run the following command and agree to the license agreement. Then it should be able to compile the C++ code in your python environment.
sudo xcodebuild -license
Usage
import face_projection as fp
warper = fp.Warper()
face_img = load_image("face.jpg") # load image of face with your favorite library
face_data = warper.create_canvas() # creates a empty image with the current size of the face model
# draw something on the face_data
# your implementation here
# project the face_data onto the face_img, using the automatic face detection
# beta is the blending factor between 0 and 1
warped_face = warper.apply(face_img, face_data, beta=0.2)
# if you already know the landmarks, you can provide them manually
warped_face = warper.apply(face_img, face_data, landmarks=landmarks, beta=0.2)
Future Work
- The user can provide a mask to disable certain parts of the projection
- Sample generators for different face properties
- More face models
- Custom face models
- Canvas fitter to fit to the general face model
References
Citation
If you use our work, please cite our paper:
TODO :^)
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 Distribution
Built Distribution
Hashes for face_projection-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f56d36425501253ea489e47b9fb81715afe8047003701a52628780196754e6d3 |
|
MD5 | 549f06545042af88c7aebd438b74cc44 |
|
BLAKE2b-256 | 17cfbbbdd514e2c4c731ab88f972c5da37d2bc1113bb3d5230bac6517d2e7735 |