java.lang.Object
imagingbook.common.geometry.mappings.linear.LinearMapping2D
- Direct Known Subclasses:
ProjectiveMapping2D
This class represents an arbitrary linear transformation in 2D. Instances of this class and any subclass are immutable. See Secs. 21.1 and 21.3 of [1] for details.
[1] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022).
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor, creates a new identity mapping.LinearMapping2D
(double[][] A) Creates a linear mapping from a transformation matrix of arbitrary size (may be even empty).LinearMapping2D
(double a00, double a01, double a02, double a10, double a11, double a12, double a20, double a21, double a22) Creates an arbitrary linear mapping from the specified matrix elements.Creates a new linear mapping from an existing linear mapping. -
Method Summary
Modifier and TypeMethodDescriptionApplies this mapping to a single 2D point.Concatenates this mapping A with another linear mapping B and returns a new mapping C, such that C(x) = B(A(x)).static LinearMapping2D
concatenate
(LinearMapping2D... AA) Concatenates a sequence of linear mappings AA = (A1, A2, ..., An), with the result A(x) = A1(A2(...(An(x))...)).Returns a copy of this mapping.Calculates and returns the inverse mapping.double[][]
Retrieves the transformation matrix for this mapping.Scales the transformation matrix such that a22 becomes 1.toString()
-
Field Details
-
a00
-
a01
-
a02
-
a10
-
a11
-
a12
-
a20
-
a21
-
a22
-
-
Constructor Details
-
LinearMapping2D
public LinearMapping2D()Constructor, creates a new identity mapping. -
LinearMapping2D
Creates a linear mapping from a transformation matrix of arbitrary size (may be even empty). The actual transformation matrix is formed by inserting the given matrix into a 3x3 identity matrix starting at position (0,0).- Parameters:
A
- a matrix of arbitrary size
-
LinearMapping2D
public LinearMapping2D(double a00, double a01, double a02, double a10, double a11, double a12, double a20, double a21, double a22) Creates an arbitrary linear mapping from the specified matrix elements.- Parameters:
a00
- matrix element A_00a01
- matrix element A_01a02
- matrix element A_02a10
- matrix element A_10a11
- matrix element A_11a12
- matrix element A_12a20
- matrix element A_20a21
- matrix element A_21a22
- matrix element A_22
-
LinearMapping2D
Creates a new linear mapping from an existing linear mapping.- Parameters:
lm
- a given linear mapping
-
-
Method Details
-
normalize
Scales the transformation matrix such that a22 becomes 1. Any linear mapping can be normalized and thereby be converted to a projective mapping (seeProjectiveMapping2D
.- Returns:
- the normalized linear mapping (i.e., a projective mapping)
-
applyTo
Description copied from interface:Mapping2D
Applies this mapping to a single 2D point. -
getInverse
Calculates and returns the inverse mapping.- Specified by:
getInverse
in interfaceInversion
- Returns:
- the inverse mapping
-
concat
Concatenates this mapping A with another linear mapping B and returns a new mapping C, such that C(x) = B(A(x)).- Parameters:
B
- the second mapping- Returns:
- the concatenated mapping
-
concatenate
Concatenates a sequence of linear mappings AA = (A1, A2, ..., An), with the result A(x) = A1(A2(...(An(x))...)). Thus, the mapping An is applied first and A1 last, with the associated transformation matrix a = a1 * a2 * ... * an. If AA is empty, the identity mapping is returned. If AA contains only a single mapping, a copy of this mapping is returned.- Parameters:
AA
- a (possibly empty) sequence of linear transformations- Returns:
- the concatenated linear transformation
-
getTransformationMatrix
Retrieves the transformation matrix for this mapping.- Returns:
- the 3x3 transformation matrix
-
duplicate
Returns a copy of this mapping.- Returns:
- a new mapping of the same type
-
toString
-