org.openimaj.math.geometry.transforms

## Class HomographyModel

• All Implemented Interfaces:
Cloneable, MatrixTransformProvider, EstimatableModel<Point2d,Point2d>, Model<Point2d,Point2d>

```public class HomographyModel
extends Object
implements EstimatableModel<Point2d,Point2d>, MatrixTransformProvider```
Implementation of a Homogeneous Homography model - a transform that models the relationship between planes under projective constraints (8 D.o.F)
Author:
Jonathon Hare
• ### Field Summary

Fields
Modifier and Type Field and Description
`protected Jama.Matrix` `homography`
`protected Predicate<HomographyModel>` `modelCheck`
`protected boolean` `normalise`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`HomographyModel` `clone()`
Clone the model
`void` `denormaliseHomography(Pair<Jama.Matrix> normalisations)`
De-normalise a homography estimate.
`boolean` `estimate(List<? extends IndependentPair<Point2d,Point2d>> data)`
DLT estimation of least-squares solution of 3D homogeneous homography
`Jama.Matrix` `getTransform()`
`int` `numItemsToEstimate()`
`Point2d` `predict(Point2d data)`
Uses the model to predict dependent data from an independent value.
`void` `setTransform(Jama.Matrix matrix)`
Set the transform matrix to the new one
• ### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

• #### modelCheck

`protected Predicate<HomographyModel> modelCheck`
• #### homography

`protected Jama.Matrix homography`
• #### normalise

`protected boolean normalise`
• ### Constructor Detail

• #### HomographyModel

`public HomographyModel(boolean norm)`
Create a `HomographyModel` with optional automatic normalisation.
Parameters:
`norm` - true if the data should be automatically normalised before running the DLT algorithm
• #### HomographyModel

```public HomographyModel(boolean norm,
Predicate<HomographyModel> mc)```
Create a `HomographyModel` with optional automatic normalisation. The given `Predicate` is used by the `estimate(List)` method to test whether the estimated homography is sensible
Parameters:
`norm` - true if the data should be automatically normalised before running the DLT algorithm
`mc` - the test function for sensible homographies
• ### Method Detail

• #### clone

`public HomographyModel clone()`
Description copied from interface: `EstimatableModel`
Clone the model
Specified by:
`clone` in interface `EstimatableModel<Point2d,Point2d>`
Overrides:
`clone` in class `Object`
Returns:
a cloned copy
• #### getTransform

`public Jama.Matrix getTransform()`
Specified by:
`getTransform` in interface `MatrixTransformProvider`
Returns:
the transform matrix represented by the object
• #### setTransform

`public void setTransform(Jama.Matrix matrix)`
Set the transform matrix to the new one
Parameters:
`matrix` - the new matrix
• #### estimate

`public boolean estimate(List<? extends IndependentPair<Point2d,Point2d>> data)`
DLT estimation of least-squares solution of 3D homogeneous homography
Specified by:
`estimate` in interface `EstimatableModel<Point2d,Point2d>`
Parameters:
`data` - Data with which to estimate the model
Returns:
true if a successful estimate was made, false otherwise
`EstimatableModel.estimate(java.util.List)`
• #### denormaliseHomography

`public void denormaliseHomography(Pair<Jama.Matrix> normalisations)`
De-normalise a homography estimate. Use when `estimate(List)` was called with pre-normalised data.
Parameters:
`normalisations` - the normalisation transforms
• #### numItemsToEstimate

`public int numItemsToEstimate()`
Specified by:
`numItemsToEstimate` in interface `EstimatableModel<Point2d,Point2d>`
Returns:
The minimum number of observations required to estimate the model.
• #### predict

`public Point2d predict(Point2d data)`
Description copied from interface: `Model`
Uses the model to predict dependent data from an independent value.
Specified by:
`predict` in interface `Model<Point2d,Point2d>`
Parameters:
`data` - the data (independent variable)
Returns:
Dependent variable(s) predicted from the independent ones.