Main interface to specify the calibration structure and run optimization. More...
#include <Calibration.h>
Public Member Functions | |
size_t | addCamera (const Camera &c) |
size_t | addPose (const Pose &p=Pose()) |
size_t | addTarget (const Target &t=Target()) |
size_t | addDistanceConstraint (const DistanceConstraint &dc=DistanceConstraint()) |
bool | checkConsistency (std::string &errorString) const |
void | saveToDisk (const std::string &filePath) const |
void | loadFromDisk (const std::string &filePath) |
void | reset () |
InitializationResult | initialize (const std::vector< Detection > &detections, const InitializationSettings &settings=InitializationSettings()) |
OptimizationResult | optimize (const std::vector< Detection > &detections, const OptimizationSettings &settings=OptimizationSettings(), std::function< bool(const int, const double)> iterationCallback=nullptr) |
CovarianceResult | estimateCovariance (const std::vector< Detection > &detections) const |
bool | estimateProjectionError (const CovarianceResult &cov, std::vector< double > &rms, std::vector< double > &max, std::vector< std::vector< std::pair< libCalib::Point2, libCalib::PixelCovariance > > > &pce) const |
bool | estimateTriangulationError (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 |
template<class Archive > | |
void | serialize (Archive &ar) |
Public Attributes | |
std::vector< Camera > | cameras |
std::vector< Pose > | poses |
std::vector< Target > | targets |
std::vector< DistanceConstraint > | distanceConstraints |
bool | isInitialized = false |
bool | isOptimized = false |
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:
bool libCalib::Calibration::checkConsistency | ( | std::string & | errorString | ) | const |
Perform various checks on the current calibration data to ensure that all entities are referenced, etc., such that initialization and calibration will be possible.
CovarianceResult libCalib::Calibration::estimateCovariance | ( | const std::vector< Detection > & | detections | ) | const |
Estimate variances/covariances of the model parameters.
bool libCalib::Calibration::estimateProjectionError | ( | const CovarianceResult & | cov, |
std::vector< double > & | rms, | ||
std::vector< double > & | max, | ||
std::vector< std::vector< std::pair< libCalib::Point2, libCalib::PixelCovariance > > > & | pce | ||
) | const |
Estimate projection errors by propagating 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.
bool libCalib::Calibration::estimateTriangulationError | ( | 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 by propagating 3d points through the calibration covariance structure. Samples points evenly on a plane in the volume occupied by calibration object points. The plane is fitted to the camera centers.
planeOffset [m]: offsets the sample plane with positive values moving in positive y-direction. featureNoise [px]: specifies the standard deviation of error that should be assumed on the detection of points in camera images.
InitializationResult libCalib::Calibration::initialize | ( | const std::vector< Detection > & | detections, |
const InitializationSettings & | settings = InitializationSettings() |
||
) |
Initialize all camera and target intrinsic and extrinsic parameters for the current calibration setup.
void libCalib::Calibration::loadFromDisk | ( | const std::string & | filePath | ) |
Deserializes a Calibration object from json file.
OptimizationResult libCalib::Calibration::optimize | ( | const std::vector< Detection > & | detections, |
const OptimizationSettings & | settings = OptimizationSettings() , |
||
std::function< bool(const int, const double)> | iterationCallback = nullptr |
||
) |
Run bundle block adjustment on all available data. Requires the Calibration to be initialized beforehand.
|
inline |
void libCalib::Calibration::saveToDisk | ( | const std::string & | filePath | ) | const |
Serializes the Calibration object to json file.