|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
Error function that projects 3D skeleton points through a bone-parented camera using an IntrinsicsModelT<T> and penalizes reprojection error in pixel space. More...
#include <camera_projection_error_function.h>
Public Member Functions | |
| CameraProjectionErrorFunctionT (const Skeleton &skel, const ParameterTransform &pt, std::shared_ptr< const IntrinsicsModelT< T > > intrinsicsModel, size_t cameraParent, const Eigen::Transform< T, 3, Eigen::Affine > &cameraOffset=Eigen::Transform< T, 3, Eigen::Affine >::Identity()) | |
| CameraProjectionErrorFunctionT (const Skeleton &skel, const ParameterTransform &pt, const CameraT< T > &camera, size_t cameraParent=kInvalidIndex) | |
| Convenience constructor that extracts intrinsics and extrinsics from a Camera. | |
| double | getError (const ModelParametersT< T > ¶ms, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState) final |
| double | getGradient (const ModelParametersT< T > ¶ms, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState, Eigen::Ref< Eigen::VectorX< T > > gradient) final |
| double | getJacobian (const ModelParametersT< T > ¶ms, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState, Eigen::Ref< Eigen::MatrixX< T > > jacobian, Eigen::Ref< Eigen::VectorX< T > > residual, int &usedRows) final |
| size_t | getJacobianSize () const final |
| void | addConstraint (const ProjectionConstraintT< T > &constraint) |
| void | clearConstraints () |
| void | setConstraints (std::vector< ProjectionConstraintT< T > > constraints) |
| const std::vector< ProjectionConstraintT< T > > & | getConstraints () const |
| size_t | getNumConstraints () const |
| bool | empty () const |
| Public Member Functions inherited from momentum::SkeletonErrorFunctionT< T > | |
| SkeletonErrorFunctionT (const Skeleton &skel, const ParameterTransform &pt) | |
| virtual | ~SkeletonErrorFunctionT ()=default |
| const Skeleton & | getSkeleton () const |
| const ParameterTransform & | getParameterTransform () const |
| virtual const Character * | getCharacter () const |
| For mesh-based error functions, get access to the underlying character. | |
| void | setWeight (T w) |
| T | getWeight () const |
| void | setActiveJoints (const VectorX< bool > &aj) |
| void | setEnabledParameters (const ParameterSet &ps) |
| virtual void | getHessian (const ModelParametersT< T > &, const SkeletonStateT< T > &, const MeshStateT< T > &, Eigen::Ref< Eigen::MatrixX< T > >) |
| virtual double | getSolverDerivatives (const ModelParametersT< T > ¶meters, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState, const size_t actualParameters, Eigen::MatrixX< T > &hess, Eigen::VectorX< T > &grad) |
| virtual bool | needsMesh () const |
Protected Attributes | |
| std::vector< ProjectionConstraintT< T > > | constraints_ |
| std::shared_ptr< const IntrinsicsModelT< T > > | intrinsicsModel_ |
| std::optional< CameraIntrinsicsMapping< T > > | intrinsicsMapping_ |
| size_t | cameraParent_ |
| Eigen::Transform< T, 3, Eigen::Affine > | cameraOffset_ |
| SkeletonDerivativeT< T > | skeletonDerivative_ |
| Protected Attributes inherited from momentum::SkeletonErrorFunctionT< T > | |
| const Skeleton & | skeleton_ |
| const ParameterTransform & | parameterTransform_ |
| T | weight_ |
| VectorX< bool > | activeJointParams_ |
| ParameterSet | enabledParameters_ |
| bool | useHessian_ {false} |
Error function that projects 3D skeleton points through a bone-parented camera using an IntrinsicsModelT<T> and penalizes reprojection error in pixel space.
If camera parameters are fixed and off-screen robustness is needed, consider using ProjectionErrorFunctionT with matrices from <momentum/camera/projection_utils.h> instead.
The camera is rigidly attached to a skeleton joint (cameraParent) with a fixed offset (cameraOffset). If cameraParent is kInvalidIndex, the camera is static in world space (cameraOffset is used directly as eyeFromWorld).
Each constraint specifies a 3D point attached to a joint and a target 2D pixel. The error is the squared distance between the projected point and the target.
Definition at line 46 of file camera_projection_error_function.h.
| momentum::CameraProjectionErrorFunctionT< T >::CameraProjectionErrorFunctionT | ( | const Skeleton & | skel, |
| const ParameterTransform & | pt, | ||
| std::shared_ptr< const IntrinsicsModelT< T > > | intrinsicsModel, | ||
| size_t | cameraParent, | ||
| const Eigen::Transform< T, 3, Eigen::Affine > & | cameraOffset = Eigen::Transform<T, 3, Eigen::Affine>::Identity() ) |
Definition at line 16 of file camera_projection_error_function.cpp.
References momentum::SkeletonErrorFunctionT< T >::activeJointParams_, cameraOffset_, cameraParent_, momentum::SkeletonErrorFunctionT< T >::enabledParameters_, intrinsicsModel_, skeletonDerivative_, and momentum::SkeletonErrorFunctionT< T >::SkeletonErrorFunctionT().
| momentum::CameraProjectionErrorFunctionT< T >::CameraProjectionErrorFunctionT | ( | const Skeleton & | skel, |
| const ParameterTransform & | pt, | ||
| const CameraT< T > & | camera, | ||
| size_t | cameraParent = kInvalidIndex ) |
Convenience constructor that extracts intrinsics and extrinsics from a Camera.
Definition at line 37 of file camera_projection_error_function.cpp.
References momentum::SkeletonErrorFunctionT< T >::activeJointParams_, cameraOffset_, cameraParent_, momentum::SkeletonErrorFunctionT< T >::enabledParameters_, intrinsicsModel_, skeletonDerivative_, and momentum::SkeletonErrorFunctionT< T >::SkeletonErrorFunctionT().
| void momentum::CameraProjectionErrorFunctionT< T >::addConstraint | ( | const ProjectionConstraintT< T > & | constraint | ) |
Definition at line 53 of file camera_projection_error_function.cpp.
References constraints_.
|
inline |
Definition at line 83 of file camera_projection_error_function.h.
|
inlinenodiscard |
Definition at line 99 of file camera_projection_error_function.h.
|
inlinenodiscard |
Definition at line 91 of file camera_projection_error_function.h.
|
nodiscardfinalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 58 of file camera_projection_error_function.cpp.
References cameraOffset_, cameraParent_, constraints_, intrinsicsMapping_, intrinsicsModel_, momentum::SkeletonStateT< T >::jointState, momentum::kInvalidIndex, and momentum::SkeletonErrorFunctionT< T >::weight_.
|
finalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 103 of file camera_projection_error_function.cpp.
References cameraOffset_, cameraParent_, constraints_, intrinsicsMapping_, intrinsicsModel_, momentum::SkeletonStateT< T >::jointState, momentum::kInvalidIndex, momentum::SkeletonErrorFunctionT< T >::parameterTransform_, skeletonDerivative_, and momentum::SkeletonErrorFunctionT< T >::weight_.
|
finalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 203 of file camera_projection_error_function.cpp.
References cameraOffset_, cameraParent_, constraints_, intrinsicsMapping_, intrinsicsModel_, momentum::SkeletonStateT< T >::jointState, momentum::kInvalidIndex, skeletonDerivative_, and momentum::SkeletonErrorFunctionT< T >::weight_.
|
nodiscardfinalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 303 of file camera_projection_error_function.cpp.
References constraints_.
|
inlinenodiscard |
Definition at line 95 of file camera_projection_error_function.h.
|
inline |
Definition at line 87 of file camera_projection_error_function.h.
|
protected |
Definition at line 108 of file camera_projection_error_function.h.
Referenced by CameraProjectionErrorFunctionT(), CameraProjectionErrorFunctionT(), getError(), getGradient(), and getJacobian().
|
protected |
Definition at line 107 of file camera_projection_error_function.h.
Referenced by CameraProjectionErrorFunctionT(), CameraProjectionErrorFunctionT(), getError(), getGradient(), and getJacobian().
|
protected |
Definition at line 104 of file camera_projection_error_function.h.
Referenced by addConstraint(), getError(), getGradient(), getJacobian(), and getJacobianSize().
|
protected |
Definition at line 106 of file camera_projection_error_function.h.
Referenced by getError(), getGradient(), and getJacobian().
|
protected |
Definition at line 105 of file camera_projection_error_function.h.
Referenced by CameraProjectionErrorFunctionT(), CameraProjectionErrorFunctionT(), getError(), getGradient(), and getJacobian().
|
protected |
Definition at line 109 of file camera_projection_error_function.h.
Referenced by CameraProjectionErrorFunctionT(), CameraProjectionErrorFunctionT(), getGradient(), and getJacobian().