### Highlights from Moving Least Squares

3.66667
3.7 | 3 ratings Rate this file 15 Downloads (last 30 days) File Size: 1.13 MB File ID: #12249 Version: 1.0

# Moving Least Squares

### Gabriele Lombardi (view profile)

13 Sep 2006 (Updated )

Tools that implements the Moving Least Squares algorithm to deform points and images

File Information
Description

This package contains a set of tools that allows to deform in real-time points and images using the Moving Least Squares algorithms. This is a fast technique to get good image deformations without using the computational expansive techniques provided by the thin-plates splines algorithms. The algorithm was published in the paper "Image Deformation Using Moving Least Squares" by Scott Schaefer, Travis McPhail, Joe Warren

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.0.1 (R14SP1)
30 Apr 2012 Joe Xiao

### Joe Xiao (view profile)

I am having trouble with the above mentioned problem. Can some one please provide some help on how to solve it? Especially the problem with inverting the computed forward lookup-coordinates?

Thanks!

Comment only
16 Jun 2011 Przem

### Przem (view profile)

This implementation is wrong. The inverse-mapping computed in the function MLSD2DWarp is the wrong solution to the problem of backward image interpolation.

The paper of [Schaefer etal. 2006] provides the math for the forward-mapping and it cannot be inverted trivially. One possible solution is to swap the point-sets (p and q) and lose the benefits of the pre-computations, but one can use the fast backward-image-warping for interpolation.

One other solution is to compute the fast forward-mapping as in [Schaefer etal. 2006] and use the slow function "griddata" (or the slightly faster "TriScatteredInterp") instead of "interp2" in order to interpolate the image. In any case, it is not that fast...

Inverting the computed forward lookup-coordinates as done in this code is in any case wrong. You can observe this, if you pull on the handles: one cannot reconstruct the results of the papers. The handles one pulls are not followed by the interpolated image...

Comment only
10 Mar 2011 Alec

### Alec (view profile)

This appears to be broken in version 2010b. MLSDeform crashes when you try to drag the points...

Okay, now I have fixed the dragging bug, but the deformations look totally wrong. The deformed image does not interpolate the control points. Is it possible that version changes in Matlab have botched this script?

Comment only
10 Mar 2011 Alec

### Alec (view profile)

This appears to be broken in version 2010b. MLSDeform crashes when you try to drag the points...

19 Oct 2010 Wei Qian

### Wei Qian (view profile)

07 Mar 2009 Shan Ming Koh

### Shan Ming Koh (view profile)

This is a very good implementation of the MLSD algorithm. It allows me to understand the algorithm in greater detail better than the actual paper. Can I borrow these functions for testing/research purposes for my thesis project which is related to 2D image manipulations?