How Portrait Deformation Powers Modern Beauty Filters: Algorithms Explained
This article explores the core portrait deformation techniques behind today’s beauty and body‑shaping effects—covering affine transforms, Moving Least Squares, triangulation, liquify, offset, 3D mesh, and deep‑learning approaches—detailing their principles, implementations, and visual results in live‑streaming and short‑video apps.
1. Background
In recent years, with the rise of live streaming and short‑video platforms, beauty and shape‑enhancing effects have become increasingly popular, appearing in almost every app as features such as face slimming, eye enlargement, and body shaping. This article introduces the portrait deformation technologies behind these effects and demonstrates several applications in facial and body beautification.
2. Portrait Deformation Algorithms
Portrait deformation is the foundation of beauty effects; it essentially applies image deformation techniques to faces and bodies. This section first presents the basic image affine transformation, then describes several commonly used portrait deformation algorithms.
2.1 Image Affine Transformation
Affine transformation maps 2D image coordinates, enabling rotation, translation, shear, scaling, and reflection. The transformation can be expressed by a matrix multiplication and translation vector. The following figure illustrates the transformation matrix and examples of translation, rotation, scaling, shear, and reflection.
The next diagram shows how an image changes under translation, rotation, scaling, shear, and reflection.
Different transformations are related as shown in the following figure.
2.2 Moving Least Squares (MLS) Deformation
The Moving Least Squares (MLS) algorithm, proposed by Scott Schaefer et al. in 2006, produces natural and smooth image deformations and is widely used in portrait deformation effects, especially for exaggerated facial transformations on static images.
Given a set of control points \(p_i\) and their deformed positions \(q_i\), MLS computes a deformation function for each pixel \(v\) that satisfies three properties: (1) each control point maps exactly to its target, (2) the deformation is smooth, and (3) if the control points do not move, the deformation reduces to the identity.
By solving a weighted least‑squares problem, MLS finds an optimal affine transformation for each pixel, which can be constrained to similarity or rigid transformations when needed. The following images illustrate MLS deformation results.
When the transformation \(M\) is affine, a closed‑form solution can be obtained by solving a least‑squares problem; for similarity or rigid transformations, additional constraints yield closed‑form solutions as well.
2.3 Triangulation Deformation
Triangulation deformation is the most widely used algorithm for beauty effects due to its simplicity, speed, and fine‑grained local control. It relies on a carefully designed triangular mesh covering the target region (e.g., the eye area) while avoiding interference with neighboring features such as eyebrows or the nose bridge.
The mesh is deformed by moving its vertices; each triangle’s affine transformation is computed from the original and deformed vertex coordinates and applied to all pixels inside the triangle.
Examples of triangulation‑based adjustments include eye enlargement, nose slimming, mouth shaping, and hairline refinement.
2.4 Liquify Deformation
Liquify deformation, another popular technique, modifies pixels within a circular region centered on a control point. The deformation intensity decreases from the center to the boundary, ensuring smooth transitions and no change at the edge.
Only pixels inside the liquify radius are affected.
Deformation strength is highest near the center and diminishes toward the edge.
The process is smooth and continuous.
Various liquify curves can be designed to control deformation strength, as shown below.
2.5 Offset Deformation
Offset deformation combines the advantages of liquify (smooth transitions) and triangulation (speed). It uses a pre‑computed pixel offset map generated by other deformation methods. The offset map is adjusted according to the target face shape and pose, then applied to the original image, achieving efficient and high‑quality results.
2.6 3D Face Deformation
2D methods ignore depth information, limiting their performance on depth‑related tasks. 3D face deformation reconstructs a 3D mesh of the face, adjusts key points in 3D space, recomputes the mesh, and renders it back to the image, enabling realistic effects such as 3D nose augmentation.
2.7 Deep‑Learning‑Based Face Deformation
With the recent surge of AI, data‑driven methods aim to automatically generate personalized beauty effects. A large dataset of before‑and‑after face images and corresponding key‑point offsets is collected. A CNN is trained to regress the offset map from the original image and its key points, enabling adaptive deformation for various face shapes.
3. Summary
Portrait deformation technology is indispensable for modern beauty effects. By deforming faces and bodies, applications can meet aesthetic standards such as facial proportion rules and body golden ratios. Ongoing research will continue to improve realism, stability, and user experience in beauty filters.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
