Automated face warping tool.
pip install pychubby
For each face in an image define what actions are to be performed on it,
pychubby will do the rest.
import matplotlib.pyplot as plt from pychubby.actions import Chubbify, Multiple, Pipeline, Smile from pychubby.detect import LandmarkFace img_path = 'path/to/your/image' img = plt.imread(img_path) lf = LandmarkFace.estimate(img) a_per_face = Pipeline([Chubbify(), Smile()]) a_all = Multiple(a_per_face) new_lf, _ = a_all.perform(lf) new_lf.plot(show_landmarks=False, show_numbers=False)
pychubby also comes with a CLI that exposes some
of its functionality. You can list the commands with
Usage: pc [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
pc perform Smile INPUT_IMG_PATH
or if you want to create a new image and save it
pc perform Smile INPUT_IMG_PATH OUTPUT_IMG_PATH
git clone https://github.com/jankrepl/pychubby.git cd pychubby pip install -e .[dev]
Subscribe to Python Awesome
Get the latest posts delivered right to your inbox