Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
momentum::CameraIntrinsicsMapping< T > Struct Template Reference

Cached mapping between intrinsic parameters and model parameter indices. More...

#include <camera_intrinsics_parameters.h>

Public Member Functions

 CameraIntrinsicsMapping (const ParameterTransform &paramTransform, const IntrinsicsModelT< T > &intrinsicsModel)
 Build the mapping from a parameter transform and intrinsics model.
bool hasActiveParams () const
 Are any intrinsic parameters being optimized?
const IntrinsicsModelT< T > & updateIntrinsics (const ModelParametersT< T > &modelParams)
 Update the mutable intrinsics model from current model parameters.
void addGradient (const Eigen::Matrix< T, 3, Eigen::Dynamic > &J_intrinsics, const Eigen::Vector2< T > &residual, T weight, Eigen::Ref< Eigen::VectorX< T > > gradient) const
 Accumulate intrinsics Jacobian contributions into the gradient vector.
void addJacobian (const Eigen::Matrix< T, 3, Eigen::Dynamic > &J_intrinsics, T weight, Eigen::Index rowOffset, Eigen::Ref< Eigen::MatrixX< T > > jacobian) const
 Accumulate intrinsics Jacobian contributions into the Jacobian matrix.

Public Attributes

std::vector< Eigen::Index > modelParamIndices
 For each intrinsic parameter i, the model parameter index, or -1 if absent.
std::shared_ptr< IntrinsicsModelT< T > > mutableIntrinsics
 Mutable clone of the intrinsics model, updated each iteration via updateIntrinsics().

Detailed Description

template<typename T>
struct momentum::CameraIntrinsicsMapping< T >

Cached mapping between intrinsic parameters and model parameter indices.

This struct is constructed once (at error function setup time) and caches the index mapping so that solve-time operations avoid string comparisons. It also holds a mutable clone of the intrinsics model that can be updated from model parameters each iteration.

Definition at line 95 of file camera_intrinsics_parameters.h.

Constructor & Destructor Documentation

◆ CameraIntrinsicsMapping()

template<typename T>
momentum::CameraIntrinsicsMapping< T >::CameraIntrinsicsMapping ( const ParameterTransform & paramTransform,
const IntrinsicsModelT< T > & intrinsicsModel )

Build the mapping from a parameter transform and intrinsics model.

The intrinsics model must have a non-empty name.

Definition at line 160 of file camera_intrinsics_parameters.cpp.

References momentum::kTiedFocalLengthSuffix, modelParamIndices, and mutableIntrinsics.

Member Function Documentation

◆ addGradient()

template<typename T>
void momentum::CameraIntrinsicsMapping< T >::addGradient ( const Eigen::Matrix< T, 3, Eigen::Dynamic > & J_intrinsics,
const Eigen::Vector2< T > & residual,
T weight,
Eigen::Ref< Eigen::VectorX< T > > gradient ) const

Accumulate intrinsics Jacobian contributions into the gradient vector.

Parameters
J_intrinsicsThe 3xN intrinsics Jacobian from projectIntrinsicsJacobian()
residualThe 2D residual (projected - target)
weightCombined weight (2 * constraint_weight * error_function_weight)
gradientThe gradient vector to accumulate into

Definition at line 206 of file camera_intrinsics_parameters.cpp.

References modelParamIndices.

◆ addJacobian()

template<typename T>
void momentum::CameraIntrinsicsMapping< T >::addJacobian ( const Eigen::Matrix< T, 3, Eigen::Dynamic > & J_intrinsics,
T weight,
Eigen::Index rowOffset,
Eigen::Ref< Eigen::MatrixX< T > > jacobian ) const

Accumulate intrinsics Jacobian contributions into the Jacobian matrix.

Parameters
J_intrinsicsThe 3xN intrinsics Jacobian from projectIntrinsicsJacobian()
weightCombined weight (sqrt(constraint_weight * error_function_weight))
rowOffsetRow offset into the Jacobian matrix (2 * constraint_index)
jacobianThe Jacobian matrix to accumulate into

Definition at line 221 of file camera_intrinsics_parameters.cpp.

References modelParamIndices.

◆ hasActiveParams()

template<typename T>
bool momentum::CameraIntrinsicsMapping< T >::hasActiveParams ( ) const
nodiscard

Are any intrinsic parameters being optimized?

Definition at line 182 of file camera_intrinsics_parameters.cpp.

References modelParamIndices.

◆ updateIntrinsics()

template<typename T>
const IntrinsicsModelT< T > & momentum::CameraIntrinsicsMapping< T >::updateIntrinsics ( const ModelParametersT< T > & modelParams)

Update the mutable intrinsics model from current model parameters.

Only modifies parameters that have active mappings; others retain their current values. Returns a reference to the updated model.

Definition at line 192 of file camera_intrinsics_parameters.cpp.

References modelParamIndices, mutableIntrinsics, and momentum::EigenStrongType< Derived, EigenType >::size().

Member Data Documentation

◆ modelParamIndices

template<typename T>
std::vector<Eigen::Index> momentum::CameraIntrinsicsMapping< T >::modelParamIndices

For each intrinsic parameter i, the model parameter index, or -1 if absent.

Definition at line 97 of file camera_intrinsics_parameters.h.

Referenced by addGradient(), addJacobian(), CameraIntrinsicsMapping(), hasActiveParams(), and updateIntrinsics().

◆ mutableIntrinsics

template<typename T>
std::shared_ptr<IntrinsicsModelT<T> > momentum::CameraIntrinsicsMapping< T >::mutableIntrinsics

Mutable clone of the intrinsics model, updated each iteration via updateIntrinsics().

Definition at line 100 of file camera_intrinsics_parameters.h.

Referenced by CameraIntrinsicsMapping(), and updateIntrinsics().


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