10#include <momentum/camera/camera.h>
26 Eigen::Vector2f
target = Eigen::Vector2f::Zero();
38 std::vector<std::vector<KeypointObservation>>
frameData;
152 std::span<
const std::vector<momentum::Marker>> markerData,
155 const Eigen::MatrixXf& initialMotion,
157 float regularizer = 0.0,
158 size_t frameStride = 1,
159 bool enforceFloorInFirstFrame =
false,
160 const std::string& firstFramePoseConstraintSet =
"",
161 float targetHeightCm = 0.0f,
162 std::span<const GloveFrameData> leftGloveData = {},
163 std::span<const GloveFrameData> rightGloveData = {},
164 const std::optional<GloveConfig>& gloveConfig = std::nullopt,
165 std::span<const CameraKeypointData> cameraKeypointData = {});
184 std::span<
const std::vector<momentum::Marker>> markerData,
187 const Eigen::MatrixXf& initialMotion,
189 const std::vector<size_t>& frames,
190 float regularizer = 0.0,
191 bool enforceFloorInFirstFrame =
false,
192 const std::string& firstFramePoseConstraintSet =
"",
193 float targetHeightCm = 0.0f,
194 std::span<const GloveFrameData> leftGloveData = {},
195 std::span<const GloveFrameData> rightGloveData = {},
196 const std::optional<GloveConfig>& gloveConfig = std::nullopt,
197 std::span<const CameraKeypointData> cameraKeypointData = {},
198 std::span<const std::vector<PlaneDataT<float>>> perFrameFloorContacts = {});
212 std::span<
const std::vector<momentum::Marker>> markerData,
216 size_t frameStride = 1,
217 std::span<const GloveFrameData> leftGloveData = {},
218 std::span<const GloveFrameData> rightGloveData = {},
219 const std::optional<GloveConfig>& gloveConfig = std::nullopt);
234 std::span<
const std::vector<momentum::Marker>> markerData,
236 const Eigen::MatrixXf& initialMotion,
238 const std::vector<size_t>& frameIndices,
239 bool isContinuous =
false,
240 std::span<const GloveFrameData> leftGloveData = {},
241 std::span<const GloveFrameData> rightGloveData = {},
242 const std::optional<GloveConfig>& gloveConfig = std::nullopt,
243 const std::string& progressLabel =
"Tracking per-frame");
263 std::span<
const std::vector<momentum::Marker>> markerData,
267 const std::array<float, 3>& regularizerWeights = {0.0f, 0.0f, 0.0f},
268 std::span<const GloveFrameData> leftGloveData = {},
269 std::span<const GloveFrameData> rightGloveData = {},
270 const std::optional<GloveConfig>& gloveConfig = std::nullopt,
271 std::span<const CameraKeypointData> cameraKeypointData = {},
272 std::vector<size_t>* selectedFrameIndices =
nullptr,
273 Eigen::MatrixXf* selectedFrameMotion =
nullptr);
284 std::span<
const std::vector<momentum::Marker>> markerData,
290 std::span<
const std::vector<momentum::Marker>> markerData,
291 const Eigen::MatrixXf& motion,
302 std::span<
const std::vector<momentum::Marker>> markerData,
303 const Eigen::MatrixXf& motion,
Eigen::MatrixXf trackSequence(const std::span< const std::vector< Marker > > markerData, const Character &character, const ParameterSet &globalParams, const MatrixXf &initialMotion, const TrackingConfig &config, float regularizer, const size_t frameStride, bool enforceFloorInFirstFrame, const std::string &firstFramePoseConstraintSet, float targetHeightCm, std::span< const GloveFrameData > leftGloveData, std::span< const GloveFrameData > rightGloveData, const std::optional< GloveConfig > &gloveConfig, std::span< const CameraKeypointData > cameraKeypointData)
Track motion across multiple frames simultaneously with temporal constraints.
Eigen::MatrixXf trackPosesForFrames(const std::span< const std::vector< Marker > > markerData, const Character &character, const MatrixXf &initialMotion, const TrackingConfig &config, const std::vector< size_t > &frameIndices, bool isContinuous, std::span< const GloveFrameData > leftGloveData, std::span< const GloveFrameData > rightGloveData, const std::optional< GloveConfig > &gloveConfig, const std::string &progressLabel)
Track poses independently for specific frame indices with fixed character identity.
std::pair< float, float > getLocatorError(std::span< const std::vector< momentum::Marker > > markerData, const MatrixXf &motion, momentum::Character &character)
Compute average and maximum marker tracking errors across all frames.
Eigen::MatrixXf trackPosesPerframe(const std::span< const std::vector< Marker > > markerData, const Character &character, const ModelParameters &globalParams, const TrackingConfig &config, const size_t frameStride, std::span< const GloveFrameData > leftGloveData, std::span< const GloveFrameData > rightGloveData, const std::optional< GloveConfig > &gloveConfig)
Track poses independently per frame with fixed character identity.
MatrixXf refineMotion(std::span< const std::vector< momentum::Marker > > markerData, const MatrixXf &motion, const RefineConfig &config, momentum::Character &character)
Refine existing motion by smoothing and optionally recalibrating identity/locators.
void calibrateLocators(const std::span< const std::vector< Marker > > markerData, const CalibrationConfig &config, const ModelParameters &identity, Character &character)
Calibrate only locator positions with fixed character identity parameters.
void calibrateModel(const std::span< const std::vector< Marker > > markerData, const CalibrationConfig &config, Character &character, ModelParameters &identity, const std::array< float, 3 > ®ularizerWeights, std::span< const GloveFrameData > leftGloveData, std::span< const GloveFrameData > rightGloveData, const std::optional< GloveConfig > &gloveConfig, std::span< const CameraKeypointData > cameraKeypointData, std::vector< size_t > *selectedFrameIndices, Eigen::MatrixXf *selectedFrameMotion)
ModelParametersT< float > ModelParameters
std::bitset< kMaxModelParams > ParameterSet
Bitset for model parameter enablement.
Common configuration for a tracking problem.
float regularization
Regularization parameter (lambda) for Levenberg-Marquardt solver.
size_t maxIter
Max number of solver iterations to run.
float minVisPercent
Minimum percentage of visible markers in a frame to consider for tracking.
float lossAlpha
Parameter to control what loss function to use.
bool debug
True to print and save debug information.
Configuration for running body and/or locator calibration.
float floorContactPercentile
Percentile threshold for adaptive floor contact detection (0-1).
bool locatorsOnly
True to calibrate only the locators and not the body.
bool enforceFloorInFirstFrame
Force all floor locators to y=0 on frame 0 with high weight.
float meshConstraintWeight
Multiplier for the mesh surface constraint weight on skinned locators during shape calibration.
float projectionWeight
Base weight for 2D keypoint projection constraints. Set to 0 to disable.
std::string firstFramePoseConstraintSet
Name of a pose constraint set to use for the first frame.
size_t majorIter
Number of iterations to run the main calibration loop.
float targetHeightCm
Target height in cm for the character, if set to 0, no height constraint is applied.
size_t greedySampling
Sample uniformly or do a greedy importance sampling.
bool adaptiveFloorContact
Enable adaptive floor contact detection during calibration.
bool calibShape
Calibrate the character's shape.
size_t calibFrames
Number of frames used in calibration. It will be a uniform sample from the input.
bool globalScaleOnly
True to only solve for a global body scale without changing individual bone length.
Per-camera 2D keypoint data for all frames.
std::vector< std::vector< KeypointObservation > > frameData
Per-frame keypoint observations.
Camera camera
Camera intrinsics and extrinsics (world-space).
A character model with skeletal structure, mesh, and optional components.
Configuration for marker gap filling and blend-off.
A single 2D keypoint observation from a camera view.
float confidence
Detection confidence, used as weight multiplier.
Eigen::Vector2f target
Target 2D pixel coordinates.
size_t locatorIndex
Index into the character's locator list.
Configuration for refining an already tracked motion, eg.
bool calibLocators
Calibrate locators when refining the motion.
bool calibId
Calibrate identity parameters when refining the motion.
float regularizer
Minimize changes to calibration parameters when in calibration mode, by regularizing towards the inpu...
Configuration for pose tracking given a calibrated body and locators.
GapFillConfig gapFillConfig
Configuration for pre-processing marker gaps before constraint creation.
float markerWeight
Multiplier for the marker position constraint weight.
float projectionWeight
Base weight for 2D keypoint projection constraints. Default 0 (disabled).
float collisionErrorWeight
The weight for the collision error function.
float smoothing
The weight for the smoothness error function.
Eigen::VectorXf smoothingWeights
Smoothing weights per model parameter.
std::optional< ParameterSet > activeParams
Optional mask to restrict which parameters are optimized during tracking.
float meshConstraintWeight
Multiplier for the mesh surface constraint weight on skinned locators.