Class CalibrationPlanarGridZhang99
- All Implemented Interfaces:
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:
- Linear estimate of pinhole camera parameters
- Estimate of camera pose
Camera model
specific initialization given the pinhole estimate- 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.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionfinal ConfigConverge
Convergence parameters for SBAfinal ConfigBundleAdjustment
Config for bundle adjustmentobservations for bundle adjustmentcontains found parametersboolean
Should it assume zero skew when estimating a pinhole camera? -
Constructor Summary
ConstructorDescriptionCalibrationPlanarGridZhang99
(Zhang99Camera cameraGenerator) Configures calibration process. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
applyDistortion
(Point2D_F64 normPt, double[] radial, double t1, double t2) Applies radial and tangential distortion to the normalized image coordinate.void
convertIntoBundleStructure
(List<Se3_F64> motions, DMatrixRMaj K, List<DMatrixRMaj> homographies, List<CalibrationObservation> observations) Convert it into a data structure understood byBundleAdjustment
int
Minimum number of calibration points in a single target that must be observed for it to process the imageprotected boolean
linearEstimate
(List<CalibrationObservation> observations) Find an initial estimate for calibration parameters using linear techniques.boolean
Use non-linear optimization to improve the parameter estimatesboolean
process
(List<CalibrationObservation> observations) Processes observed calibration point coordinates and computes camera intrinsic and extrinsic parameters.void
setVerbose
(@Nullable PrintStream out, @Nullable Set<String> configuration) static int
totalPoints
(List<CalibrationObservation> observations)
-
Field Details
-
zeroSkew
public boolean zeroSkewShould it assume zero skew when estimating a pinhole camera? -
configConvergeSBA
Convergence parameters for SBA -
configSBA
Config for bundle adjustment -
structure
contains found parameters -
observations
observations for bundle adjustment
-
-
Constructor Details
-
CalibrationPlanarGridZhang99
Configures calibration process.
-
-
Method Details
-
process
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
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> observations) Convert it into a data structure understood byBundleAdjustment
-
computeErrors
-
getCameraModel
-
applyDistortion
Applies radial and tangential distortion to the normalized image coordinate.- Parameters:
normPt
- point in normalized image coordinatesradial
- radial distortion parameterst1
- tangential parametert2
- tangential parameter
-
totalPoints
-
setVerbose
public void setVerbose(@Nullable @Nullable PrintStream out, @Nullable @Nullable Set<String> configuration) - Specified by:
setVerbose
in interfaceVerbosePrint
-
getMinimumObservedPoints
public int getMinimumObservedPoints()Minimum number of calibration points in a single target that must be observed for it to process the image
-