Class SelfCalibrationPraticalGuessAndCheckFocus

All Implemented Interfaces:

public class SelfCalibrationPraticalGuessAndCheckFocus
extends Object
implements VerbosePrint

Computes the best projective to metric 4x4 rectifying homography matrix by guessing different values for focal lengths of the first two views. Focal lengths are guessed using a log scale. Skew and image center are both assumed to be known and have to be specified by the user. This strategy shows better convergence than methods which attempt to guess the focal length using linear or gradient descent approaches due to the vast number of local minima in the search space. Non-linear refinement is highly recommended after using this algorithm due to its approximate nature.

NOTE: Performance on noise free synthetic data replicates paper claims. Have not been able to replicate performance on real data. Authors were contacted for a reference implementation and was told source code is not publicly available.

  • if sameFocus is set to true then the first two views are assumed to have approximately the same focal length
  • Internally, the plane at infinity is computed using the known intrinsic parameters.
  • Rectifying homography is computed using known K in first view and plane at infinity. lambda of 1 is assumed
Changes from paper:
  1. Extracting K using absolute quadratic instead of rectifying homography

There will be a sign ambiguity in the returned result for the translation vector. That can be resolved by checking for positive depth of triangulated features.

See Also:
Gherardi, Riccardo, and Andrea Fusiello. "Practical autocalibration." European Conference on Computer Vision. Springer, Berlin, Heidelberg, 2010.
  • Constructor Details

    • SelfCalibrationPraticalGuessAndCheckFocus

      public SelfCalibrationPraticalGuessAndCheckFocus()
  • Method Details

    • setCamera

      public void setCamera​(double skew, double cx, double cy, int width, int height)
      Specifies known portions of camera intrinsic parameters
      skew - skew
      cx - image center x
      cy - image center y
      width - Image width
      height - Image height
    • setSampling

      public void setSampling​(double min, double max, int total)
      Specifies how focal lengths are sampled on a log scale. Remember 1.0 = nominal length
      min - min value. 0.3 is default
      max - max value. 3.0 is default
      total - Number of sample points. 50 is default
    • process

      public boolean process​(List<DMatrixRMaj> cameraMatrices)
      Computes the best rectifying homography given the set of camera matrices. Must call setCamera(double, double, double, int, int) first.

      DO NOT ADD P1=[I|0] it is implicit!

      cameraMatrices - (Input) camera matrices for view 2 and beyond. Do not add the implicit P1=[I|0]
      true if successful or false if it fails
    • isFixedFocus

      public boolean isFixedFocus()
    • setSingleCamera

      public void setSingleCamera​(boolean sameFocus)
    • getRectifyingHomography

      public DMatrixRMaj getRectifyingHomography()
      Returns the projective to metric rectifying homography
    • isLocalMinimum

      public boolean isLocalMinimum()
    • setVerbose

      public void setVerbose​(@Nullable @Nullable PrintStream out, @Nullable @Nullable Set<String> configuration)
      Specified by:
      setVerbose in interface VerbosePrint