images.geotrans.LocalWeightedMeanTransformation2D class

Package: images.geotrans

2-D Local Weighted Mean Geometric Transformation


An images.geotrans.LocalWeightedMeanTransformation2D object encapsulates a 2-D local weighted mean geometric transformation.


tform = images.geotrans.LocalWeightedMeanTransformation2D(movingPoints,fixedPoints,n) constructs an images.geotrans.LocalWeightedMeanTransformation2D object given m-by-2 matrices movingPoints and fixedPoints, which define matched control points in the moving and fixed images, respectively. The local weighted mean transformation creates a mapping, by inferring a polynomial at each control point using neighboring control points. The mapping at any location depends on a weighted average of these polynomials. The n closest points are used to infer a second degree polynomial transformation for each control point pair. n can be as small as 6, but making it small risks generating ill-conditioned polynomials.



Dimensionality of geometric transformation

Describes the dimensionality of the geometric transformation for both input and output points.


images.geotrans.LocalWeightedMeanTransformation2d.outputLimitsFind output limits of geometric transformation
images.geotrans.LocalWeightedMeanTransformation2d.transformPointsInverseApply inverse geometric transformation

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB® documentation.


collapse all

Fit set of fixed and moving control points using second degree polynomial

Fit a local weighted mean transformation to a set of fixed and moving control points that are actually related by a global second degree polynomial transformation across the entire plane.

Set up variables.

x = [10, 12, 17, 14, 7, 10];
y = [8, 2, 6, 10, 20, 4];
a = [1 2 3 4 5 6];
b = [2.3 3 4 5 6 7.5];
u = a(1) + a(2).*x + a(3).*y + a(4) .*x.*y + a(5).*x.^2 + a(6).*y.^2;
v = b(1) + b(2).*x + b(3).*y + b(4) .*x.*y + b(5).*x.^2 + b(6).*y.^2;
movingPoints = [u',v'];
fixedPoints = [x',y'];

Fit local weighted mean transformation to points.

tformLocalWeightedMean = images.geotrans.LocalWeightedMeanTransformation2D(movingPoints,fixedPoints,6);

Verify the fit of our LocalWeightedMeanTransformation2D object at the control points.

movingPointsComputed = transformPointsInverse(tformLocalWeightedMean,fixedPoints);
errorInFit = hypot(movingPointsComputed(:,1)-movingPoints(:,1),...
Was this topic helpful?