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
Adds a camera to the calibration setup.
Parameters:
c | The Camera object to add. |
Returns:
size_t | The index of the added camera. |
addRobot()¶
size_taddRobot
Adds a robot to the calibration setup.
Parameters:
r | The Robot object to add. |
Returns:
size_t | The index of the added robot. |
addLidar()¶
size_taddLidar
Adds a lidar to the calibration setup.
Parameters:
l | The Lidar object to add. |
Returns:
size_t | The index of the added lidar. |
addPose()¶
size_taddPose
Adds a pose to the calibration setup.
Parameters:
p | The Pose object to add. |
Returns:
size_t | The index of the added pose. |
addTarget()¶
size_taddTarget
Adds a target to the calibration setup.
Parameters:
t | The Target object to add. |
Returns:
size_t | The index of the added target. |
addDistanceConstraint()¶
size_taddDistanceConstraint
Adds a distance constraint to the calibration setup.
Parameters:
dc | The DistanceConstraint object to add. |
Returns:
size_t | The index of the added constraint. |
checkConsistency()¶
boolcheckConsistency
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:
errorString | Populated with an error message if the check fails. |
Returns:
bool | True 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()¶
InitializationResultinitializeconst 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:
imageDetections | Detection data from images. |
pointCloudDetections | Detection data from point clouds (lidars). |
robotPoses | Robot pose records. |
settings | Initialization settings. |
Returns:
InitializationResult | Result of the initialization. |
initialize()¶
InitializationResultinitializeconst std::vector< ImageDetection > & imageDetections,const InitializationSettings & settings = InitializationSettings()
Initialize camera parameters (convenience overload).
Parameters:
imageDetections | Detection data from images. |
settings | Initialization settings. |
Returns:
InitializationResult | Result of the initialization. |
optimize()¶
OptimizationResultoptimizeconst 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:
imageDetections | Detection data from images. |
pointCloudDetections | Detection data from point clouds. |
robotPoses | Robot pose records. |
settings | Optimization settings. |
iterationCallback | Optional callback function called at each iteration. |
Returns:
OptimizationResult | Result of the optimization. |
optimize()¶
OptimizationResultoptimizeconst std::vector< ImageDetection > & imageDetections,const OptimizationSettings & settings = OptimizationSettings(),std::function< bool(const int, const double)> iterationCallback = nullptr
Run bundle adjustment optimization (convenience overload).
Parameters:
imageDetections | Detection data from images. |
settings | Optimization settings. |
iterationCallback | Optional callback function called at each iteration. |
Returns:
OptimizationResult | Result of the optimization. |
estimateCovariance()¶
CovarianceResultestimateCovariance
Estimate variances/covariances of the model parameters.
Parameters:
detections | Image detections used for covariance estimation. |
Returns:
CovarianceResult | The estimated covariance result. |
estimateProjectionError()¶
boolestimateProjectionError
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:
cov | The covariance result used for estimation. |
rms | RMS error for each camera. |
max | Max error for each camera. |
pce | Vector of point/covariance pairs for visualization. |
Returns:
bool | True if successful. |
estimateTriangulationError()¶
boolestimateTriangulationError
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:
cov | The covariance result used for estimation. |
rms | RMS error. |
max | Max error. |
pc | Point clouds with covariances. |
errors | Error 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:
bool | True if successful. |
computeNextBestPose()¶
PosecomputeNextBestPose
Compute optimal next target pose.
Calculates the next best pose for the calibration target given the current calibration and detections.
Parameters:
detections | Current image detections. |
Returns:
Pose | The 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.