Class SelfCalibrationEssentialGuessAndCheck

All Implemented Interfaces:

public class SelfCalibrationEssentialGuessAndCheck
extends Object
implements VerbosePrint

Brute force sampling approach to perform self calibration of a partially calibrated image. The focal length for the first and second images are selected by sampling a grid of values and selecting the hypothesis with the smallest model fit error is selected.

Assumptions: fx and fy are identical, zero principle point, and no lens distortion. There are no false positives in the input set.

  1. Create a list of different focal length hypothesis
  2. Use a given hypothesis to compute the Essential matrix
  3. Decompose essential matrix and get 4 extrinsic hypotheses
  4. Select best hypothesis and save result. Repeat for all focal lengths
The list of hypothetical focal lengths is generated using a log scale causing it to generate more hypotheses on the lower end. The camera matrix for view-1 is an 3x4 identity matrix. The output comes in various forms:
  • Select focal lengths for camera
  • Rectifying homography
  1. P. Abeles, "BoofCV Technical Report: Automatic Camera Calibration" 2020-1
See Also:
  • Field Details

    • sampleFocalRatioMin

      public double sampleFocalRatioMin
      Range of values focal length values will sample. Fraction relative to imageLengthPixels
    • sampleFocalRatioMax

      public double sampleFocalRatioMax
      Range of values focal length values will sample. Fraction relative to imageLengthPixels
    • numberOfSamples

      public int numberOfSamples
      Number of values it will sample
    • fixedFocus

      public boolean fixedFocus
      if true the focus is assumed to be the same for the first two images
    • focalLengthA

      public double focalLengthA
      The selected focal length for the first image
    • focalLengthB

      public double focalLengthB
      The selected focal length for the second image
    • rectifyingHomography

      public final DMatrixRMaj rectifyingHomography
      The selected rectifying homography
    • isLimit

      public boolean isLimit
      If true that indicates that the selected focal length was at the upper or lower limit. This can indicate a fault
    • imageLengthPixels

      public int imageLengthPixels
      The length of the longest side in the image. In pixels.
    • calibrator

      public final TwoViewToCalibratingHomography calibrator
      Generates and scores a hypothesis given two intrinsic camera matrices
  • Constructor Details

    • SelfCalibrationEssentialGuessAndCheck

      public SelfCalibrationEssentialGuessAndCheck()
  • Method Details

    • configure

      public void configure​(double sampleFocalRatioMin, double sampleFocalRatioMax)
      Specifies the range of focal lengths it will evaluate as ratio of imageLengthPixels
      sampleFocalRatioMin - The minimum allowed focal length ratio
      sampleFocalRatioMax - Tha maximum allowed focal length ratio
    • process

      public boolean process​(DMatrixRMaj F21, DMatrixRMaj P2, List<AssociatedPair> observations)
      Selects the best focal length(s) given the trifocal tensor and observations
      F21 - (Input) Fundamental matrix between view-1 and view-2
      P2 - (Input) Projective camera matrix for view-1 with inplicit identity matrix view-1
      observations - (Input) Observation for all three views. Highly recommend that RANSAC or similar is used to remove false positives first.
      true if successful
    • setVerbose

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