org.geotools.referencing.operation.builder
Class AffineTransformBuilder
Object
MathTransformBuilder
ProjectiveTransformBuilder
AffineTransformBuilder
public class AffineTransformBuilder
- extends ProjectiveTransformBuilder
Builds MathTransform setup as Affine transformation from a list of MappedPosition. The calculation uses least square method.
The Affine transform equation:
[ x'] [ m00 m01 m02 ] [ x ] [ m00x + m01y + m02 ]
[ y'] = [ m10 m11 m12 ] [ y ] = [ m10x + m11y + m12 ]
[ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
x' = m * x
In the case that we have more identical points we can
write it like this (in Matrix):
[ x'1 ] [ x1 y1 1 0 0 0 ] [ m00 ]
[ x'2 ] [ x2 y2 1 0 0 0 ] [ m01 ]
[ . ] [ . ] [ m02 ]
[ . ] [ . ] * [ m10 ]
[ x'n ] = [ xn yn 1 0 0 0 ] [ m11 ]
[ y'1 ] [ 0 0 0 x1 y1 1 ] [ m12 ]
[ y'2 ] [ 0 0 0 x2 y2 1 ]
[ . ] [ . ]
[ . ] [ . ]
[ y'n ] [ 0 0 0 xn yn 1 ]
x' = A*m
Using the least square method we get this result:
m = (ATA)-1 ATx'
- Since:
- 2.4
- Author:
- Jan Jezek
- Module:
modules/library/referencing (gt-referencing.jar)
Methods inherited from class MathTransformBuilder |
getDimension, getErrorStatistics, getMappedPositions, getMathTransform, getName, getSourceCRS, getSourcePoints, getTargetCRS, getTargetPoints, getTransformation, printPoints, setMappedPositions, setSourcePoints, setTargetPoints, toString |
AffineTransformBuilder
protected AffineTransformBuilder()
AffineTransformBuilder
public AffineTransformBuilder(List<MappedPosition> vectors)
throws MismatchedSizeException,
MismatchedDimensionException,
MismatchedReferenceSystemException
- Creates AffineTransformBuilder for the set of properties.
- Parameters:
vectors
- list of MappedPosition
- Throws:
MismatchedSizeException
MismatchedDimensionException
MismatchedReferenceSystemException
getMinimumPointCount
public int getMinimumPointCount()
- Returns the minimum number of points required by this builder,
which is 3.
- Overrides:
getMinimumPointCount
in class ProjectiveTransformBuilder
- Returns:
- the minimum number of points required by this builder, which is
3.
getProjectiveMatrix
protected GeneralMatrix getProjectiveMatrix()
- Returns the matrix for Projective transformation setup as
Affine. The M matrix looks like this:
[ m00 m01 m02 ]
[ m10 m11 m12 ]
[ 0 0 1 ]
- Overrides:
getProjectiveMatrix
in class ProjectiveTransformBuilder
- Returns:
- Matrix M.
fillAMatrix
protected void fillAMatrix()
- Description copied from class:
ProjectiveTransformBuilder
- Fills A matrix for m = (ATPA)-1
ATPx' equation
- Overrides:
fillAMatrix
in class ProjectiveTransformBuilder
Copyright © 1996-2009 Geotools. All Rights Reserved.