public class HomographyLinear4
extends java.lang.Object
Using linear algebra it computes a planar homography matrix using for or more points. Typically used as an initial estimate for a non-linear optimization.
The algorithm works by solving the equation below:
hat(x2)*H*x1 = 0
where hat(x) is the skew symmetric cross product matrix. To solve this equation is is reformatted into
A*Hs=0 using the Kronecker product and the null space solved for.
Primarily based on chapter 4 in, "Multiple View Geometry in Computer Vision" 2nd Ed. but uses normalization from "An Invitation to 3-D Vision" 2004.
| Modifier and Type | Field and Description |
|---|---|
protected org.ejml.data.DenseMatrix64F |
A |
protected org.ejml.data.DenseMatrix64F |
N1 |
protected org.ejml.data.DenseMatrix64F |
N2 |
protected org.ejml.interfaces.decomposition.SingularValueDecomposition<org.ejml.data.DenseMatrix64F> |
svd |
| Constructor and Description |
|---|
HomographyLinear4(boolean normalizeInput)
Configure homography calculation
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
computeH(org.ejml.data.DenseMatrix64F A,
org.ejml.data.DenseMatrix64F H)
Computes the SVD of A and extracts the homography matrix from its null space
|
protected void |
createA(java.util.List<AssociatedPair> points,
org.ejml.data.DenseMatrix64F A)
Compute the 'A' matrix used to solve for H from un-normalized points.
|
protected void |
createANormalized(java.util.List<AssociatedPair> points,
org.ejml.data.DenseMatrix64F A)
Compute the 'A' matrix used to solve for H from normalized points.
|
boolean |
process(java.util.List<AssociatedPair> points,
org.ejml.data.DenseMatrix64F foundH)
Computes the homography matrix given a set of observed points in two images.
|
protected void |
undoNormalizationH(org.ejml.data.DenseMatrix64F M,
org.ejml.data.DenseMatrix64F N1,
org.ejml.data.DenseMatrix64F N2)
Undoes normalization for a homography matrix.
|
protected org.ejml.data.DenseMatrix64F A
protected org.ejml.interfaces.decomposition.SingularValueDecomposition<org.ejml.data.DenseMatrix64F> svd
protected org.ejml.data.DenseMatrix64F N1
protected org.ejml.data.DenseMatrix64F N2
public HomographyLinear4(boolean normalizeInput)
normalizeInput - Should image coordinate be normalized? Needed when coordinates are in units of pixels.public boolean process(java.util.List<AssociatedPair> points, org.ejml.data.DenseMatrix64F foundH)
Computes the homography matrix given a set of observed points in two images. A set of AssociatedPair
is passed in. The computed homography 'H' is found such that the attributes 'keyLoc' and 'currLoc' in AssociatedPair
refers to x1 and x2, respectively, in the equation below:
x2 = H*x1
points - A set of observed image points that are generated from a planar object. Minimum of 4 pairs required.foundH - Output: Storage for the found solution. 3x3 matrix.protected boolean computeH(org.ejml.data.DenseMatrix64F A,
org.ejml.data.DenseMatrix64F H)
protected void undoNormalizationH(org.ejml.data.DenseMatrix64F M,
org.ejml.data.DenseMatrix64F N1,
org.ejml.data.DenseMatrix64F N2)
protected void createANormalized(java.util.List<AssociatedPair> points, org.ejml.data.DenseMatrix64F A)
protected void createA(java.util.List<AssociatedPair> points, org.ejml.data.DenseMatrix64F A)