Python module for face feature changing
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/
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.
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)
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
By default we are using a pretrained landmark model from https://github.com/davisking/dlib-models.
This Project Has Been MIT Licensed