Calico
A visual-inertial calibration library designed for rapid problem construction and debugging.
Public Member Functions | List of all members
calico::sensors::Camera Class Reference

Camera class. More...

#include <camera.h>

Inheritance diagram for calico::sensors::Camera:
Inheritance graph
[legend]
Collaboration diagram for calico::sensors::Camera:
Collaboration graph
[legend]

Public Member Functions

 Camera (const Camera &)=delete
 
Cameraoperator= (const Camera &)=delete
 
void SetName (const std::string &name)
 
const std::string & GetName () const
 
void SetExtrinsics (const Pose3d &T_sensorrig_sensor)
 
const Pose3dGetExtrinsics () const
 
absl::Status SetIntrinsics (const Eigen::VectorXd &intrinsics)
 
const Eigen::VectorXd & GetIntrinsics () const
 
absl::Status SetLatency (double latency)
 
double GetLatency () const
 
void EnableExtrinsicsEstimation (bool enable)
 
void EnableIntrinsicsEstimation (bool enable)
 
void EnableLatencyEstimation (bool enable)
 
void SetLossFunction (utils::LossFunctionType loss, double scale) final
 Setter for loss function and scale.
 
absl::StatusOr< int > AddParametersToProblem (ceres::Problem &problem) final
 Add this sensor's calibration parameters to the ceres problem. More...
 
absl::StatusOr< int > AddResidualsToProblem (ceres::Problem &problem, Trajectory &sensorrig_trajectory, WorldModel &world_model) final
 Contribue this sensor's residuals to the ceres problem. More...
 
absl::Status SetMeasurementNoise (double sigma) final
 Set the measurement noise \(\sigma\). More...
 
absl::Status UpdateResiduals (ceres::Problem &problem) final
 Update residuals for this sensor. More...
 
void ClearResidualInfo () final
 Clear all stored info about residuals.
 
absl::StatusOr< std::vector< CameraMeasurement > > Project (const std::vector< double > &interp_times, const Trajectory &sensorrig_trajectory, const WorldModel &world_model) const
 Compute synthetic camera measurements given a Trajectory and WorldModel. More...
 
absl::Status SetModel (CameraIntrinsicsModel camera_model)
 Setter for the camera model.
 
CameraIntrinsicsModel GetModel () const
 Getter for the camera model.
 
absl::Status AddMeasurement (const CameraMeasurement &measurement)
 Add a single camera measurement to the measurement list. More...
 
absl::Status AddMeasurements (const std::vector< CameraMeasurement > &measurements)
 Add multiple measurements to the measurement list. More...
 
const absl::flat_hash_map< CameraObservationId, CameraMeasurement > & GetMeasurementIdToMeasurement () const
 
absl::StatusOr< std::vector< std::pair< CameraMeasurement, Eigen::Vector2d > > > GetMeasurementResidualPairs () const
 Returns a vector of measurement-residual pairs. More...
 
absl::Status MarkOutlierById (const CameraObservationId &id)
 Tag a single measurement as an outlier by its measurement ID. More...
 
absl::Status MarkOutliersById (const std::vector< CameraObservationId > &ids)
 Tag multiple measurements as outliers by measurement ID. More...
 
void ClearOutliersList ()
 Clear outliers list.
 
void ClearMeasurements ()
 Clear all measurements. More...
 
int NumberOfMeasurements () const
 Get current number of measurements stored.
 

Detailed Description

Camera class.

Member Function Documentation

◆ AddMeasurement()

absl::Status calico::sensors::Camera::AddMeasurement ( const CameraMeasurement measurement)

Add a single camera measurement to the measurement list.

Returns an error if the measurement's id is duplicated without adding.

◆ AddMeasurements()

absl::Status calico::sensors::Camera::AddMeasurements ( const std::vector< CameraMeasurement > &  measurements)

Add multiple measurements to the measurement list.

Returns an error status if any measurements are duplicates within its internally managed set of measurements.

Note: If this method encounters any duplicates, it will STILL attempt to add the entire vector. If it returns an error status, it means that all unique measurements have been added, but duplicates have been skipped.

◆ AddParametersToProblem()

absl::StatusOr< int > calico::sensors::Camera::AddParametersToProblem ( ceres::Problem &  problem)
finalvirtual

Add this sensor's calibration parameters to the ceres problem.

Returns the number of parameters added to the problem, which should be intrinsics + extrinsics + latency. If the sensor's model hasn't been set yet, it will return an invalid argument error.

Implements calico::sensors::Sensor.

◆ AddResidualsToProblem()

absl::StatusOr< int > calico::sensors::Camera::AddResidualsToProblem ( ceres::Problem &  problem,
Trajectory sensorrig_trajectory,
WorldModel world_model 
)
finalvirtual

Contribue this sensor's residuals to the ceres problem.

sensorrig_trajectory is the world-from-sensorrig trajectory \(\mathbf{T}^w_r(t)\).

Implements calico::sensors::Sensor.

◆ ClearMeasurements()

void calico::sensors::Camera::ClearMeasurements ( )

Clear all measurements.

This will also clear any internally stored residuals and marked outliers.

◆ GetMeasurementIdToMeasurement()

const absl::flat_hash_map< CameraObservationId, CameraMeasurement > & calico::sensors::Camera::GetMeasurementIdToMeasurement ( ) const

Getter for all measurements. Returns a map of observation ids to measurements. Will be empty if there are no measurements.

◆ GetMeasurementResidualPairs()

absl::StatusOr< std::vector< std::pair< CameraMeasurement, Eigen::Vector2d > > > calico::sensors::Camera::GetMeasurementResidualPairs ( ) const

Returns a vector of measurement-residual pairs.

Only returns for measurements that have residuals. Returns an error if there are more residuals than measurements, or if there are no measurements.

Note: This method will only return residuals for measurements that have NOT been marked as outliers.

◆ MarkOutlierById()

absl::Status calico::sensors::Camera::MarkOutlierById ( const CameraObservationId id)

Tag a single measurement as an outlier by its measurement ID.

Camera class keeps track of an outliers list internally. If passed a measurement ID that does not correspond with any measurement tracked by this camera, an InvalidArgument status is returned.

◆ MarkOutliersById()

absl::Status calico::sensors::Camera::MarkOutliersById ( const std::vector< CameraObservationId > &  ids)

Tag multiple measurements as outliers by measurement ID.

Camera class keeps track of an outliers list internally. If passed a measurement ID that does not correspond with any measurement tracked by this camera, an InvalidArgument status is returned.

◆ Project()

absl::StatusOr< std::vector< CameraMeasurement > > calico::sensors::Camera::Project ( const std::vector< double > &  interp_times,
const Trajectory sensorrig_trajectory,
const WorldModel world_model 
) const

Compute synthetic camera measurements given a Trajectory and WorldModel.

This method projects the world model through the kinematic chain at given timestamps. This method returns only valid synthetic measurements as would be observed by the actual sensor, complying with physicality such as features being in front of the camera. Returns measurements in the order of the interpolation timestamps.

interp_times is a vector of timestamps in seconds at which sensorrig_trajectory will be interpolated. No assumptions are made about timestamp uniqueness or order.

sensorrig_trajectory is the world-from-sensorrig trajectory \(\mathbf{T}^w_r(t)\).

◆ SetMeasurementNoise()

absl::Status calico::sensors::Camera::SetMeasurementNoise ( double  sigma)
finalvirtual

Set the measurement noise \(\sigma\).

This value is used to weight the sensor's residuals such that:

\[ \boldsymbol{\Sigma} = \sigma^2\mathbf{I}\\ \boldsymbol{\epsilon} = \boldsymbol{\Sigma}^{-1/2}\left(\mathbf{y} - \mathbf{\hat{y}}\left(\mathbf{x}, \boldsymbol{\beta}\right)\right)\\ \mathbf{J} = \frac{\partial\boldsymbol{\epsilon}}{\partial\delta\boldsymbol{\beta}}\\ \delta\boldsymbol{\beta} = \left(\mathbf{J}^T\mathbf{J}\right)^{-1}\mathbf{J}^T\boldsymbol{\epsilon} \]

Implements calico::sensors::Sensor.

◆ UpdateResiduals()

absl::Status calico::sensors::Camera::UpdateResiduals ( ceres::Problem &  problem)
finalvirtual

Update residuals for this sensor.

This will only apply to measurements not marked as outliers.

Note: This method is meant to be invoked by BatchOptimizer ONLY. It is not recommended that you invoke this method manually.

Implements calico::sensors::Sensor.


The documentation for this class was generated from the following files: