Skip to main content

Automated face warping tool

Project description

PyWarping

Python module for face feature changing

Installation

pip install pywarping

If you get an error: No such file or directory: 'cmake': 'cmake', you need to make sure cmake is installed. If you're on OSX you can install this via Homebrew with:

brew install cmake

For other platforms please consult the Cmake documentation at https://cmake.org/install/

Usage

For each face in an image define what actions are to be performed on it, pywarping will do the rest. Check out the docs here.

Minimal Example

import matplotlib.pyplot as plt

from pywarping.actions import Chubby, Multiple, Pipeline, Smile
from pywarping.detect import LandmarkFace

img_path = 'path/to/your/image'
img = plt.imread(img_path)

lf = LandmarkFace.estimate(img)

a_per_face = Pipeline([Chubby(), Smile()])
a_all = Multiple(a_per_face)

new_lf, _ = a_all.perform(lf)
new_lf.plot(show_landmarks=False, show_numbers=False)

CLI

pywarping also comes with a CLI that exposes some of its functionality. You can list the commands with pw --help:

Usage: pw [OPTIONS] COMMAND [ARGS]...

  Automated face warping tool.

Options:
  --help  Show this message and exit.

Commands:
  list     List available actions.
  perform  Take an action.

To perform an action (Smile in the example below) and plot the result on the screen

pw perform Smile INPUT_IMG_PATH

or if you want to create a new image and save it

pw perform Smile INPUT_IMG_PATH OUTPUT_IMG_PATH

Notes

By default we are using a pretrained landmark model from https://github.com/davisking/dlib-models.

License

This Project Has Been MIT Licensed

Project details


Release history Release notifications | RSS feed

This version

0.2

Download files

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

Source Distribution

pywarping-0.2.tar.gz (17.3 kB view details)

Uploaded Source

File details

Details for the file pywarping-0.2.tar.gz.

File metadata

  • Download URL: pywarping-0.2.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.8

File hashes

Hashes for pywarping-0.2.tar.gz
Algorithm Hash digest
SHA256 3c5d896137c8ab9954bc7717891997a72cbd49d03c813ca652b083c5baa27255
MD5 8f7dfe86a68b7c1872210829761c9cc8
BLAKE2b-256 e78500db31cc248d31e913d4c690b737d2a89a60b65219bf79435fd4cbb97966

See more details on using hashes here.

Supported by

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