Main Content

LocalWeightedMeanTransformation2D

2-D local weighted mean geometric transformation

Description

ALocalWeightedMeanTransformation2Dobject encapsulates a 2-D local weighted mean geometric transformation.

Creation

You can create aLocalWeightedMeanTransformation2Dobject using the following methods:

  • Thefitgeotransfunction, which estimates a geometric transformation that maps pairs of control points between two images.

  • Theimages.geotrans.LocalWeightedMeanTransformation2Ddescribed here. This function creates aLocalWeightedMeanTransformation2Dobject using coordinates of fixed points and moving points, and a specified number of points to use in the local weighted mean calculation.

Description

example

tform = images.geotrans.LocalWeightedMeanTransformation2D(movingPoints,fixedPoints,n)creates aLocalWeightedMeanTransformation2Dobject given control point coordinates inmovingPointsandfixedPoints, which define matched control points in the moving and fixed images, respectively. Thenclosest points are used to infer a second degree polynomial transformation for each control point pair.

Input Arguments

expand all

x- andy坐标的控制点moving image, specified as anm-by-2 matrix. The number of control pointsmmust be greater than or equal ton.

Data Types:double|single

x- andy-coordinates of control points in the fixed image, specified as anm-by-2 matrix. The number of control pointsmmust be greater than or equal ton.

Data Types:double|single

Number of points to use in local weighted mean calculation, specified as a numeric value.ncan be as small as 6, but makingnsmall risks generating ill-conditioned polynomials

Data Types:double|single|uint8|uint16|uint32|uint64|int8|int16|int32

Properties

expand all

Dimensionality of the geometric transformation for both input and output points, specified as the value 2.

Object Functions

outputLimits Find output spatial limits given input spatial limits
transformPointsInverse Apply inverse geometric transformation

Examples

collapse all

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 theLocalWeightedMeanTransformation2Dobject at the control points.

movingPointsComputed = transformPointsInverse(tformLocalWeightedMean,fixedPoints); errorInFit = hypot(movingPointsComputed(:,1)-movingPoints(:,1),...movingPointsComputed(:,2)-movingPoints(:,2))

Algorithms

The local weighted mean transformation infers a polynomial at each control point using neighboring control points. The mapping at any location depends on a weighted average of these polynomials. Thenclosest points are used to infer a second degree polynomial transformation for each control point pair.ncan be as small as 6, but making it small risks generating ill-conditioned polynomials.

Version History

Introduced in R2013b