Skip to main content

This projects main goal is to have a simple library to project information into faces while retaining the facial structure.

Project description

face-projection

Teaser

Are you looking for a powerful, user-friendly tool to project information onto faces while maintaining their natural structure? Look no further – face-projection is here to simplify how you visualize facial data. The tool is open-source, easy to use, and written in Python, allowing you to easily integrate it into your existing workflow. We try to keep the dependencies to a minimum so you can use them in your projects without worrying about compatibility issues. However, we do not guarantee perfect anatomical correctness of the results but try to keep the distortion to a minimum.

All people shown here in the repository examples were generated with StableDiffusion (Prompt: A professional portrait photo of a person directly looking <emotion> at the camera, white background, photoshop, Instagram)

Installation

The tool is available on PyPI.

pip install face-projection

Usage

The tool reduces the overhead of projecting information onto faces to a minimum. Load the data and face, project it, and you are done. You must only ensure the data is inside the canonical face model (see electromyogram for an example). The head pose can be arbitrary, but the face must be visible.

import face_projection as fp
from PIL import Image

image_face = np.asarray(Image.open("face.jpg").convert("RGB"))
image_data = np.asarray(Image.open("data.jpg").convert("RGB"))

warper = fp.Warper()
warped = warper.apply(image_face, image_data, beta=0.2)

We automatically detect the face in the image, compute the landmarks based on the Blaze model, and warp the data onto it. You can decide how much of the underlying face should be visible by adjusting the beta parameter.

In examples/ you can find a more detailed example, which generates the teaser image.

Future Work

We have many ideas for future work, but we are also happy to hear your suggestions. The following todos are in no particular order but should give you an idea of what we are planning.

  • The user can provide a mask to turn off certain parts of the projection
  • Different default warpings based on the six default Ekman emotions
  • More face models
  • Custom face models
  • Upgrade to the newest mediapipe version to avoid MacOS build issues

Citation

If you use our work, please cite our paper:

under publication, so coming soon :^)

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

face-projection-1.1.1.tar.gz (4.1 MB view details)

Uploaded Source

Built Distribution

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

face_projection-1.1.1-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

File details

Details for the file face-projection-1.1.1.tar.gz.

File metadata

  • Download URL: face-projection-1.1.1.tar.gz
  • Upload date:
  • Size: 4.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for face-projection-1.1.1.tar.gz
Algorithm Hash digest
SHA256 9ec1ee03379b5d49ad29f185e9dfdf18d974d89266ec1d977325c69337185a94
MD5 d253887342a3cc76e86745cb57b3f600
BLAKE2b-256 0c17d2f833d1c6ebcb204a98cfabfad086fcee3378dc9997e3b0701c4e9a1a3d

See more details on using hashes here.

File details

Details for the file face_projection-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for face_projection-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d8235988125bc2fe99555fdac43ac8f00124a254a3078c0c03f313506ff07d2f
MD5 c9263b52d9cff2ed16518289431c12b2
BLAKE2b-256 896c3884f2c5d5384e7cc0b40a7dc0516782e0a095dc89e7687d92e3f434c5a9

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