Class CalibrationPlanarGridZhang99

java.lang.Object
boofcv.alg.geo.calibration.CalibrationPlanarGridZhang99
All Implemented Interfaces:
VerbosePrint

public class CalibrationPlanarGridZhang99
extends Object
implements VerbosePrint

Full implementation of the Zhang99 camera calibration algorithm using planar calibration targets. The original algorithm has been extended to support multiple camera models. The general process is described below:

  1. Linear estimate of pinhole camera parameters
  2. Estimate of camera pose
  3. Camera model specific initialization given the pinhole estimate
  4. Non-linear refinement of intrinsic and extrinsic parameters

The algorithm has been extended to multiple camera models by providing each camera model an initial estimate of the pinhole camera parameters with camera pose. If the camera model has radial distortion, as modeled by CameraPinholeBrown, then an initial estimate of radial distortion is estimated inside the camera model specific code. See specific cameras for how they are all initialized.

When processing the results be sure to take in account the coordinate system being left or right handed. Calibration works just fine with either coordinate system, but most 3D geometric algorithms assume a right handed coordinate system while most images are left handed.

A listener can be provide that will give status updates and allows requests for early termination. If a request for early termination is made then a RuntimeException will be thrown.

[1] Zhengyou Zhang, "Flexible Camera Calibration By Viewing a Plane From Unknown Orientations,", International Conference on Computer Vision (ICCV'99), Corfu, Greece, pages 666-673, September 1999.

  • Field Details

    • zeroSkew

      public boolean zeroSkew
      Should it assume zero skew when estimating a pinhole camera?
    • structure

      public SceneStructureMetric structure
      contains found parameters
    • observations

      public SceneObservations observations
  • Constructor Details

    • CalibrationPlanarGridZhang99

      public CalibrationPlanarGridZhang99​(List<Point2D_F64> layout, Zhang99Camera cameraGenerator)
      Configures calibration process.
      Parameters:
      layout - Layout of calibration points on the target
  • Method Details

    • process

      public boolean process​(List<CalibrationObservation> observations)
      Processes observed calibration point coordinates and computes camera intrinsic and extrinsic parameters.
      Parameters:
      observations - Set of observed grid locations in pixel coordinates.
      Returns:
      true if successful and false if it failed
    • linearEstimate

      protected boolean linearEstimate​(List<CalibrationObservation> observations)
      Find an initial estimate for calibration parameters using linear techniques.
    • performBundleAdjustment

      public boolean performBundleAdjustment()
      Use non-linear optimization to improve the parameter estimates
    • convertIntoBundleStructure

      public void convertIntoBundleStructure​(List<Se3_F64> motions, DMatrixRMaj K, List<DMatrixRMaj> homographies, List<CalibrationObservation> calibrationObservations)
      Convert it into a data structure understood by BundleAdjustment
    • computeErrors

      public List<ImageResults> computeErrors()
    • getCameraModel

      public CameraModel getCameraModel()
    • applyDistortion

      public static void applyDistortion​(Point2D_F64 normPt, double[] radial, double t1, double t2)
      Applies radial and tangential distortion to the normalized image coordinate.
      Parameters:
      normPt - point in normalized image coordinates
      radial - radial distortion parameters
      t1 - tangential parameter
      t2 - tangential parameter
    • totalPoints

      public static int totalPoints​(List<CalibrationObservation> observations)
    • setVerbose

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