public class ImageDeformPointMLS_F32 extends java.lang.Object implements Point2Transform2_F32
Implementation of 'Moving Least Squares' (MLS) control point based image deformation models described in [1].
Usage Procedure:configure(int, int, int, int)addControl(float, float) for each control pointfixateUndistorted() when all control points have been addedsetDistorted(int, float, float) to change the distorted location of a control pointfixateDistorted() after you are done changing distorted locationsEach control point has an undistorted and distorted location. The fixate functions are used to precompute different portions of the deformation to maximize speed by avoiding duplicate computations. Instead of computing a distortion for each pixel a regular grid is used instead. Pixel points are interpolated between grid points using bilinear interpolation.
This should be a faithful implementation of MLS. Potential deviations listed below:
[1] Schaefer, Scott, Travis McPhail, and Joe Warren. "Image deformation using moving least squares." ACM transactions on graphics (TOG). Vol. 25. No. 3. ACM, 2006.
| Modifier and Type | Class and Description |
|---|---|
class |
ImageDeformPointMLS_F32.AffineModel
See paper section 2.1
|
static class |
ImageDeformPointMLS_F32.Cache |
static class |
ImageDeformPointMLS_F32.Control |
class |
ImageDeformPointMLS_F32.RigidModel
Paper section 2.3
|
class |
ImageDeformPointMLS_F32.SimilarityModel
See paper section 2.2
|
| Constructor and Description |
|---|
ImageDeformPointMLS_F32(TypeDeformMLS type) |
| Modifier and Type | Method and Description |
|---|---|
int |
add(float srcX,
float srcY,
float dstX,
float dstY)
Function that let's you set control and undistorted points at the same time
|
int |
addControl(float x,
float y)
Adds a new control point at the specified location.
|
void |
compute(float x,
float y,
georegression.struct.point.Point2D_F32 out)
Applies transformation
|
void |
configure(int width,
int height,
int gridRows,
int gridCols)
Specifies the input image size and the size of the grid it will use to approximate the idea solution.
|
void |
fixateDistorted()
Recompute the deformation of each point in the internal grid now that the location of control points is
not changing any more.
|
void |
fixateUndistorted()
Precompute the portion of the equation which only concerns the undistorted location of each point on the
grid even the current undistorted location of each control point.
|
float |
getAlpha() |
void |
reset()
Discards all existing control points
|
void |
setAlpha(float alpha) |
void |
setDistorted(int which,
float x,
float y)
Sets the distorted location of a specific control point
|
void |
setUndistorted(int which,
float x,
float y)
Sets the location of a control point.
|
public ImageDeformPointMLS_F32(TypeDeformMLS type)
public void reset()
public void configure(int width,
int height,
int gridRows,
int gridCols)
width - Image widthheight - Image heightgridRows - grid rowsgridCols - grid columnspublic int addControl(float x,
float y)
x - coordinate x-axis in image pixelsy - coordinate y-axis in image pixelspublic void setUndistorted(int which,
float x,
float y)
x - coordinate x-axis in image pixelsy - coordinate y-axis in image pixelspublic int add(float srcX,
float srcY,
float dstX,
float dstY)
srcX - distorted coordinatesrcY - distorted coordinatedstX - undistorted coordinatedstY - undistorted coordinatepublic void setDistorted(int which,
float x,
float y)
which - Which control pointx - distorted coordinate x-axis in image pixelsy - distorted coordinate y-axis in image pixelspublic void fixateUndistorted()
public void fixateDistorted()
fixateUndistorted() first.public void compute(float x,
float y,
georegression.struct.point.Point2D_F32 out)
Point2Transform2_F32compute in interface Point2Transform2_F32x - x-coordinate of pointy - y-coordinate of pointout - Transformed point location.public float getAlpha()
public void setAlpha(float alpha)