Class ProjectiveStructureFromHomographies


public class ProjectiveStructureFromHomographies extends Object

Given a set of homographies mapping pixels in view i to view 0 this will estimate the projective camera matrix of each view. x' = P*X, where P is the camera matrix that is to be estimated, x' is pixel, and X is 3D feature location in view 0's reference frame. Output is 3D structure and camera matrices.

A camera matrix is a 3x4 projective matrix with the following structure [M,t]. If a homography defines the transform between pixels in one view to another view then M is equal to that homography. The camera matrix is now defined up to the unknown t. To solve for t the points in this projective frame also need to be derived. This is done by solving a linear system:

     [ p.x*m'[2] - m'[0] , -1 , 0  , p.x ]
     [ p.y*m'[2] - m'[1] ,  0 , -1 , p.y ] * [X ; t ]
where m'[i] is row 'i' in M transposed. (p.x,p.y) is pixel observation, X and t are the unknowns. Each observation x = P*X generates 2 equations. See [1] for derivation. Vector product of both sides is involved.

Normalization is automatically applied to inputs and undo for output. Normalization matrix is computed using LowLevelMultiViewOps.computeNormalizationLL(List, BoofLambdas.ConvertOut, NormalizationPoint2D)

[1] 18.5.1 Page 448 in R. Hartley, and A. Zisserman, "Multiple View Geometry in Computer Vision", 2nd Ed, Cambridge 2003

  • Constructor Details

    • ProjectiveStructureFromHomographies

      public ProjectiveStructureFromHomographies()
  • Method Details

    • proccess

      public boolean proccess(List<DMatrixRMaj> homographies_view0_to_viewI, List<List<PointIndex2D_F64>> observations, int totalFeatures)

      Solves for camera matrices and scene structure.

      Homographies from view i to 0:
      x[0] = H*x[i]
      homographies_view0_to_viewI - (Input) Homographies matching pixels from view i to view 0.
      observations - (Input) Observed features in each view, except view 0. Indexes of points must be from 0 to totalFeatures-1
      totalFeatures - (Input) total number of features being solved for. Uses to sanity check input
      true if successful or false if it failed
    • getCameraMatrix

      public void getCameraMatrix(int viewIdx, DMatrixRMaj P)
    • getFeature3D

      public void getFeature3D(int featureIdx, Point3D_F64 X)
    • getInfinityThreshold

      public double getInfinityThreshold()
    • setInfinityThreshold

      public void setInfinityThreshold(double infinityThreshold)