AI Glossary / Computer vision and multimodal AI / Intermediate
Moving least squares (MLS) deformation
Definition
Moving least squares (MLS) deformation is a way to warp an image or shape from a set of control handles. For each location being warped, it fits a transformation to the handle correspondences using distance-dependent weights. Nearby handles usually have more influence. Evaluating these locally fitted transformations across the image creates a flexible deformation.
What it means
An editor specifies original control positions and their desired new positions. MLS fills in how the rest of the image should move. The word moving refers to the fitting neighborhood changing with the evaluation location, not to a requirement for video or animated input.
The permitted local transformation controls the character of the warp. Affine fitting can include shear and nonuniform scaling. Similarity fitting restricts the local model to rotation, translation, and uniform scale. Rigid fitting removes scale from that local model. These are constraints on each fitted transformation; a spatially varying collection of local fits can still deform the overall object.
How it works
At an image location v, assign each control pair a weight that decreases with its distance from v. Fit a transformation that minimizes the weighted sum of squared differences between transformed original handles and their target positions. Apply that fitted transformation to v, then repeat or evaluate a precomputed representation at other locations.
The classic formulation uses inverse-distance powers and handles control-point locations specially so the warp interpolates the requested positions. Weighted centroids help separate translation from the remaining fit. Implementations can evaluate a grid and render the warped image efficiently. Image resampling is still required: the coordinate deformation and the interpolation of color values are separate parts of producing the final picture.
Three practical examples
1. An illustration tool lets an artist drag a character's hand while anchoring its torso. MLS spreads the adjustment through neighboring image regions.
2. A morphing demonstration moves a small set of corresponding landmarks between two shapes. The intermediate warp is controlled by the handle layout and local transformation family.
3. A design application adjusts the profile of a drawn object using line-segment handles. The deformation can be guided along an outline rather than by a dense set of isolated points.
Think of it this way
Think of attaching movable pins to a flexible printed sheet. Pulling one pin influences nearby parts more strongly than distant anchored parts. The analogy makes local influence intuitive, but MLS does not simulate the sheet's material, forces, or elasticity. Its behavior comes from weighted geometric fitting, so it should not be interpreted as a physically validated deformation model.
Worked example
Consider three non-collinear control points: p1 = (0, 0), p2 = (2, 0), and p3 = (0, 2). Move every handle by the same translation t = (3, 1), giving targets (3, 1), (5, 1), and (3, 3).
At any ordinary evaluation location, the transformation T(x) = x + t maps all three controls to their targets with zero residual. It is compatible with affine, similarity, and rigid transformation families. Thus the fitted mapping reproduces that common translation, and the point v = (1, 1) moves to (4, 2).
Now move only one handle while keeping the others fixed. No single rigid transformation generally satisfies all those requests exactly across the whole image. MLS uses location-dependent fits so different regions respond differently. This explains how a method using local rigid fits can nevertheless produce a globally deforming image, and why “rigid MLS” should not be read as “the entire image remains one rigid object.”
Illustrative case study
Fictional case: A children's-book illustrator wants to raise a drawn character's arm without repainting the full figure. A prototype uses affine MLS and stretches the sleeve noticeably. The illustrator compares similarity and rigid variants and adds anchors around the shoulder and torso.
The adjusted result better matches the intended pose, but a tight cluster of controls creates an undesirable fold near the elbow. The team revises the handle placement and inspects the deformation on a checkerboard as well as the artwork. The tool remains an editing aid, with visual review required for large or conflicting handle movements.
Common misconceptions and mistakes
MLS is not simply a weighted average of control-point displacements; the fitted transformation family matters. It is also not automatically equivalent to a global least-squares transform, since the weights and fitted model change with location.
Local rigidity does not guarantee a globally rigid, area-preserving, or fold-free map. Extreme handle motions can create undesirable distortion or overlap. Degenerate handle configurations can make a fit poorly determined, and directly evaluating inverse-distance weights at a handle requires care. A mathematically smooth coordinate map also does not guarantee sharp output pixels after resampling or large enlargement.
Business use
MLS deformation can support interactive illustration, image morphing, layout adjustment, and visual prototyping. It offers direct control through a relatively small number of handles and can feel intuitive when the handle placement reflects the object's structure.
Evaluate the transformation family against the intended material or visual style, without confusing that resemblance with physical accuracy. Test identity, common translation, rotation, and extreme handle configurations. Inspect folding and image borders, and assess resampling quality separately. Preserve the original image and handle configuration so edits remain reproducible and adjustable.
People also ask
Does moving least squares require a moving image?
No. The fitting weights move with the evaluation point; the input can be one still image.
Does rigid MLS keep every distance in the entire image unchanged?
No. Its local fitted transformations are rigid, but they vary spatially and collectively deform the image.
Are point handles the only option?
No. The original image-deformation work also develops line-segment handles for controlling profiles.
Check your understanding
Every handle receives the same translation. What should a well-posed MLS deformation reproduce?
Answer: That same translation throughout the image, because it fits all handle correspondences exactly within the relevant transformation families.
Related terms
- Image warping
- Weighted least squares
- Affine transformation
- Resampling
- control point
- similarity transformation
- rigid transformation
- morphing
Learn next
Use a checkerboard with a few control handles. Compare affine, similarity, and rigid MLS under the same drag, then add an anchor and observe the change. Test a common translation first to verify the implementation before interpreting more complex deformations.
More in Computer vision and multimodal AI
- Motion field - A motion field is a spatial collection of motion vectors.
- Motion-JPEG - Motion-JPEG, often written MJPEG or M-JPEG, represents video as a sequence of separately JPEG-compressed images.
- Motion vector - A motion vector is a numerical description of movement between positions, usually expressed as horizontal and vertical displacement in an image.
- Moving object detection - Moving object detection is the identification of image regions or objects that are moving over time.
- MS-SSIM - MS-SSIM, or multiscale structural similarity, is a full-reference image-quality measure that compares a test image with a reference at several spatial scales.
- Multi-spectral image - A multi-spectral image records a scene in several wavelength bands of electromagnetic radiation.
Sources
Primary research source: Scott Schaefer, Travis McPhail, and Joe Warren, “Image Deformation Using Moving Least Squares,” https://people.engr.tamu.edu/schaefer/research/mls.pdf . Relevant weighted-fitting, transformation-family, and handle material was read. The translation calculation and illustration scenario are original teaching examples; no fold-free or physical-simulation guarantee is claimed.
Previous: Moving average crossover Next: Moving object detection