Package paletai.mapping
Class Homography
java.lang.Object
paletai.mapping.Homography
A class for applying homography transformations to points.
Wraps the mathematical operations from
MathHomography
with convenient point transformation methods.
This class maintains both a homography matrix and its inverse, allowing efficient forward and backward transformations between coordinate systems.
Key features:
- Forward and inverse homography transformations
- Automatic inverse matrix calculation
- Matrix state management
- Integration with Processing's PVector system
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a Homography object initialized with identity matrices. -
Method Summary
Modifier and TypeMethodDescriptionvoidupdateHomographyMatrix(float[][] h) Updates the homography matrix and automatically calculates its inverse.processing.core.PVectorvectorInvertTransform(processing.core.PVector in) Transforms a point using the inverse homography matrix (backward transformation).processing.core.PVectorvectorTransform(processing.core.PVector in) Transforms a point using the homography matrix (forward transformation).
-
Constructor Details
-
Homography
public Homography()Constructs a Homography object initialized with identity matrices. Creates both the homography matrix and its inverse as identity matrices, resulting in no transformation when applied.- See Also:
-
-
Method Details
-
updateHomographyMatrix
public void updateHomographyMatrix(float[][] h) Updates the homography matrix and automatically calculates its inverse. Maintains both matrices for efficient forward and backward transformations.- Parameters:
h- The new 3x3 homography matrix to use- See Also:
-
vectorTransform
public processing.core.PVector vectorTransform(processing.core.PVector in) Transforms a point using the homography matrix (forward transformation). Applies the perspective transformation: out = H * in. Transforms from source coordinates to destination coordinates.- Parameters:
in- The input point to transform- Returns:
- The transformed point in destination coordinates
-
vectorInvertTransform
public processing.core.PVector vectorInvertTransform(processing.core.PVector in) Transforms a point using the inverse homography matrix (backward transformation). Applies the inverse perspective transformation: out = inv(H) * in. Transforms from destination coordinates back to source coordinates. This is useful for mapping points from the output space back to the original input space.- Parameters:
in- The input point to inverse-transform (in destination coordinates)- Returns:
- The inverse-transformed point in source coordinates
-