|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
Error function that projects skinned mesh vertices through a bone-parented camera using an IntrinsicsModelT<T> and penalizes reprojection error. More...
#include <camera_vertex_projection_error_function.h>
Public Member Functions | |
| CameraVertexProjectionErrorFunctionT (const Character &character, 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()) | |
| CameraVertexProjectionErrorFunctionT (const Character &character, const ParameterTransform &pt, const CameraT< T > &camera, size_t cameraParent=kInvalidIndex) | |
| Convenience constructor that extracts intrinsics and extrinsics from a Camera. | |
| const Character * | getCharacter () const final |
| For mesh-based error functions, get access to the underlying character. | |
| bool | needsMesh () const final |
| 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 CameraVertexProjectionDataT< T > &constraint) |
| void | clearConstraints () |
| void | setConstraints (std::vector< CameraVertexProjectionDataT< T > > constraints) |
| const std::vector< CameraVertexProjectionDataT< T > > & | getConstraints () const |
| size_t | getNumConstraints () const |
| bool | empty () const |
| void | setMaxThreads (size_t maxThreads) |
| 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 |
| 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) |
Protected Attributes | |
| const Character & | character_ |
| std::vector< CameraVertexProjectionDataT< 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_ |
| size_t | maxThreads_ = 0 |
| 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 skinned mesh vertices through a bone-parented camera using an IntrinsicsModelT<T> and penalizes reprojection error.
Combines vertex-based skinning derivatives (with blend shape support) and camera bone extrinsics optimization with optional intrinsics optimization. This enables dense mesh keypoints to contribute to camera parameter optimization, unlike VertexProjectionErrorFunctionT which uses a fixed pre-baked projection matrix.
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.
Definition at line 46 of file camera_vertex_projection_error_function.h.
| momentum::CameraVertexProjectionErrorFunctionT< T >::CameraVertexProjectionErrorFunctionT | ( | const Character & | character, |
| 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 24 of file camera_vertex_projection_error_function.cpp.
References momentum::SkeletonErrorFunctionT< T >::activeJointParams_, cameraOffset_, cameraParent_, character_, momentum::SkeletonErrorFunctionT< T >::enabledParameters_, intrinsicsModel_, skeletonDerivative_, and momentum::SkeletonErrorFunctionT< T >::SkeletonErrorFunctionT().
| momentum::CameraVertexProjectionErrorFunctionT< T >::CameraVertexProjectionErrorFunctionT | ( | const Character & | character, |
| const ParameterTransform & | pt, | ||
| const CameraT< T > & | camera, | ||
| size_t | cameraParent = kInvalidIndex ) |
Convenience constructor that extracts intrinsics and extrinsics from a Camera.
Definition at line 46 of file camera_vertex_projection_error_function.cpp.
References momentum::SkeletonErrorFunctionT< T >::activeJointParams_, cameraOffset_, cameraParent_, character_, momentum::SkeletonErrorFunctionT< T >::enabledParameters_, intrinsicsModel_, skeletonDerivative_, and momentum::SkeletonErrorFunctionT< T >::SkeletonErrorFunctionT().
| void momentum::CameraVertexProjectionErrorFunctionT< T >::addConstraint | ( | const CameraVertexProjectionDataT< T > & | constraint | ) |
Definition at line 77 of file camera_vertex_projection_error_function.cpp.
References constraints_.
|
inline |
Definition at line 86 of file camera_vertex_projection_error_function.h.
|
inlinenodiscard |
Definition at line 102 of file camera_vertex_projection_error_function.h.
|
nodiscardfinalvirtual |
For mesh-based error functions, get access to the underlying character.
Error functions that depend only on the skeleton can return nullptr.
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 67 of file camera_vertex_projection_error_function.cpp.
References character_.
|
inlinenodiscard |
Definition at line 94 of file camera_vertex_projection_error_function.h.
|
nodiscardfinalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 83 of file camera_vertex_projection_error_function.cpp.
References cameraOffset_, cameraParent_, momentum::cast(), constraints_, intrinsicsMapping_, intrinsicsModel_, momentum::SkeletonStateT< T >::jointState, momentum::kInvalidIndex, MT_CHECK_NOTNULL, momentum::MeshStateT< T >::posedMesh_, and momentum::SkeletonErrorFunctionT< T >::weight_.
|
finalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 128 of file camera_vertex_projection_error_function.cpp.
References cameraOffset_, cameraParent_, momentum::cast(), character_, constraints_, intrinsicsMapping_, intrinsicsModel_, momentum::SkeletonStateT< T >::jointState, momentum::kInvalidIndex, maxThreads_, MT_CHECK_NOTNULL, momentum::SkeletonErrorFunctionT< T >::parameterTransform_, momentum::MeshStateT< T >::posedMesh_, skeletonDerivative_, and momentum::SkeletonErrorFunctionT< T >::weight_.
|
finalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 248 of file camera_vertex_projection_error_function.cpp.
References cameraOffset_, cameraParent_, momentum::cast(), character_, constraints_, getJacobian(), intrinsicsMapping_, intrinsicsModel_, momentum::SkeletonStateT< T >::jointState, momentum::kInvalidIndex, maxThreads_, MT_CHECK_NOTNULL, momentum::MeshStateT< T >::posedMesh_, skeletonDerivative_, and momentum::SkeletonErrorFunctionT< T >::weight_.
Referenced by getJacobian().
|
nodiscardfinalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 364 of file camera_vertex_projection_error_function.cpp.
References constraints_, and getJacobianSize().
Referenced by getJacobianSize().
|
inlinenodiscard |
Definition at line 98 of file camera_vertex_projection_error_function.h.
|
nodiscardfinalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 72 of file camera_vertex_projection_error_function.cpp.
|
inline |
Definition at line 90 of file camera_vertex_projection_error_function.h.
|
inline |
Definition at line 106 of file camera_vertex_projection_error_function.h.
|
protected |
Definition at line 116 of file camera_vertex_projection_error_function.h.
Referenced by CameraVertexProjectionErrorFunctionT(), CameraVertexProjectionErrorFunctionT(), getError(), getGradient(), and getJacobian().
|
protected |
Definition at line 115 of file camera_vertex_projection_error_function.h.
Referenced by CameraVertexProjectionErrorFunctionT(), CameraVertexProjectionErrorFunctionT(), getError(), getGradient(), and getJacobian().
|
protected |
Definition at line 111 of file camera_vertex_projection_error_function.h.
Referenced by CameraVertexProjectionErrorFunctionT(), CameraVertexProjectionErrorFunctionT(), getCharacter(), getGradient(), and getJacobian().
|
protected |
Definition at line 112 of file camera_vertex_projection_error_function.h.
Referenced by addConstraint(), getError(), getGradient(), getJacobian(), and getJacobianSize().
|
protected |
Definition at line 114 of file camera_vertex_projection_error_function.h.
Referenced by getError(), getGradient(), and getJacobian().
|
protected |
Definition at line 113 of file camera_vertex_projection_error_function.h.
Referenced by CameraVertexProjectionErrorFunctionT(), CameraVertexProjectionErrorFunctionT(), getError(), getGradient(), and getJacobian().
|
protected |
Definition at line 118 of file camera_vertex_projection_error_function.h.
Referenced by getGradient(), and getJacobian().
|
protected |
Definition at line 117 of file camera_vertex_projection_error_function.h.
Referenced by CameraVertexProjectionErrorFunctionT(), CameraVertexProjectionErrorFunctionT(), getGradient(), and getJacobian().