Skip to content

Class libCalibGeom::Calibration

Main interface to specify the calibration structure and run optimization.

The class is responsible for holding the calibration data and initializing/optimizing all parameters.

The typical workflow consists of: adding the appropriate number of empty Camera, Pose and Target objects. collecting Detection objects which reference specific cameras, targets and poses. calling initialize() calling optimize()

Constructors and destructors

Calibration()

Calibration()

Returns:

void

Public member functions

addCamera()

size_taddCamera(const Camera & c)

Adds a camera to the calibration setup.

Parameters:

cThe Camera object to add.

Returns:

size_tThe index of the added camera.

addRobot()

size_taddRobot(const Robot & r = Robot())

Adds a robot to the calibration setup.

Parameters:

rThe Robot object to add.

Returns:

size_tThe index of the added robot.

addLidar()

size_taddLidar(const Lidar & l = Lidar())

Adds a lidar to the calibration setup.

Parameters:

lThe Lidar object to add.

Returns:

size_tThe index of the added lidar.

addPose()

size_taddPose(const Pose & p = Pose())

Adds a pose to the calibration setup.

Parameters:

pThe Pose object to add.

Returns:

size_tThe index of the added pose.

addTarget()

size_taddTarget(const Target & t = Target())

Adds a target to the calibration setup.

Parameters:

tThe Target object to add.

Returns:

size_tThe index of the added target.

addDistanceConstraint()

size_taddDistanceConstraint(const DistanceConstraint & dc = DistanceConstraint())

Adds a distance constraint to the calibration setup.

Parameters:

dcThe DistanceConstraint object to add.

Returns:

size_tThe index of the added constraint.

checkConsistency()

boolcheckConsistency(std::string &errorString) const

Checks if the calibration setup is consistent.

Perform various checks on the current calibration data to ensure that all entities are referenced correctly, such that initialization and calibration will be possible.

Parameters:

errorStringPopulated with an error message if the check fails.

Returns:

boolTrue if the setup is consistent, false otherwise.

reset()

voidreset()

Resets the calibration setup and deletes all owned Camera, Pose, Target, Detection and DistanceConstrain objects.

Returns:

void

initialize()

InitializationResultinitialize(const std::vector< ImageDetection > & imageDetections,const std::vector< PointCloudDetection > & pointCloudDetections,const std::vector< PoseRecord > & robotPoses,const InitializationSettings & settings = InitializationSettings())

Initialize the intrinsic and extrinsic parameters.

Initializes parameters for all devices in the current calibration setup, based on the provided detections.

Parameters:

imageDetectionsDetection data from images.
pointCloudDetectionsDetection data from point clouds (lidars).
robotPosesRobot pose records.
settingsInitialization settings.

Returns:

InitializationResultResult of the initialization.

initialize()

InitializationResultinitialize(const std::vector< ImageDetection > & imageDetections,const InitializationSettings & settings = InitializationSettings())

Initialize camera parameters (convenience overload).

Parameters:

imageDetectionsDetection data from images.
settingsInitialization settings.

Returns:

InitializationResultResult of the initialization.

optimize()

OptimizationResultoptimize(const std::vector< ImageDetection > & imageDetections,const std::vector< PointCloudDetection > & pointCloudDetections,const std::vector< PoseRecord > & robotPoses,const OptimizationSettings & settings = OptimizationSettings(),std::function< bool(const int, const double)> iterationCallback = nullptr)

Run bundle adjustment optimization.

Run bundle block adjustment on the provided detections. Requires that the Calibration is initialized first.

Parameters:

imageDetectionsDetection data from images.
pointCloudDetectionsDetection data from point clouds.
robotPosesRobot pose records.
settingsOptimization settings.
iterationCallbackOptional callback function called at each iteration.

Returns:

OptimizationResultResult of the optimization.

optimize()

OptimizationResultoptimize(const std::vector< ImageDetection > & imageDetections,const OptimizationSettings & settings = OptimizationSettings(),std::function< bool(const int, const double)> iterationCallback = nullptr)

Run bundle adjustment optimization (convenience overload).

Parameters:

imageDetectionsDetection data from images.
settingsOptimization settings.
iterationCallbackOptional callback function called at each iteration.

Returns:

OptimizationResultResult of the optimization.

estimateCovariance()

CovarianceResultestimateCovariance(const std::vector< ImageDetection > &detections) const

Estimate variances/covariances of the model parameters.

Parameters:

detectionsImage detections used for covariance estimation.

Returns:

CovarianceResultThe estimated covariance result.

estimateProjectionError()

boolestimateProjectionError(const CovarianceResult &cov, std::vector< double > &rms, std::vector< double > &max, std::vector< std::vector< std::pair< libCalibGeom::Point2, libCalibGeom::PixelCovariance >>> &pce) const

Estimate projection errors.

Propagates unprojected 3d points through the calibration covariance of each camera individually. Returns 2D pixel covariances for the projected points evenly sampled on the image planes.

Parameters:

covThe covariance result used for estimation.
rmsRMS error for each camera.
maxMax error for each camera.
pceVector of point/covariance pairs for visualization.

Returns:

boolTrue if successful.

estimateTriangulationError()

boolestimateTriangulationError(const CovarianceResult &cov, double &rms, double &max, std::vector< std::pair< Point3, PointCovariance >> &pc, std::vector< std::array< Point3, 100 >> &errors, const double planeOffset=0.0, const double featureNoise=0.0) const

Estimate triangulation errors.

Propagates 3d points through the calibration covariance structure. Samples points evenly on a plane in the volume occupied by calibration object points. The plane is aligned to the cameras' mean optical axis and mean x-axis.

Parameters:

covThe covariance result used for estimation.
rmsRMS error.
maxMax error.
pcPoint clouds with covariances.
errorsError vectors.
planeOffset[m] Offsets the sample plane along the plane normal.
featureNoise[px] Specifies the standard deviation of error that should be assumed on the detection of points in camera images.

Returns:

boolTrue if successful.

computeNextBestPose()

PosecomputeNextBestPose(const std::vector< ImageDetection > &detections) const

Compute optimal next target pose.

Calculates the next best pose for the calibration target given the current calibration and detections.

Parameters:

detectionsCurrent image detections.

Returns:

PoseThe recommended next pose.

Public data members

cameras

std::vector< Camera >cameras

No documentation provided.

robots

std::vector< Robot >robots

No documentation provided.

lidars

std::vector< Lidar >lidars

No documentation provided.

poses

std::vector< Pose >poses

Roto-translation transforms moving from the calibration target rig frame to the camera rig frame at a specific configuration.

targets

std::vector< Target >targets

Optimized target geometries.

distanceConstraints

std::vector< DistanceConstraint >distanceConstraints

Soft constraints for absolute distances between specified features.

isInitialized

boolisInitialized

No documentation provided.

isOptimized

boolisOptimized

No documentation provided.