Rather than applying a single action at a time
pychubby enables piping multiple actions together.
To achieve this one can use the metaaction
Let us again assume that we start with an image with a single face in it.
Let’s try to make the person smile but also close her eyes slightly.
import matplotlib.pyplot as plt from pychubby.actions import OpenEyes, Pipeline, Smile from pychubby.detect import LandmarkFace img = plt.imread("path/to/the/image") lf = LandmarkFace.estimate(img) a_s = Smile(0.1) a_e = OpenEyes(-0.03) a = Pipeline([a_s, a_e]) new_lf, df = a.perform(lf) new_lf.plot(show_landmarks=False)
To create an animation we can use the visualization module.
from pychubby.visualization import create_animation ani = create_animation(df, img)