pymomentum.marker_tracking

Module for exposing the C++ APIs of the marker tracking pipeline

class pymomentum.marker_tracking.BaseConfig

Bases: pybind11_object

Represents base config class

property debug

Whether to output debugging info

property loss_alpha

Parameter to control the loss function

property max_iter

Max iterations

property min_vis_percent

Minimum percentage of visible markers to be used

class pymomentum.marker_tracking.CalibrationConfig

Bases: BaseConfig

Config for the body scale calibration step

property calib_frames

Number of frames used for model calibration

property global_scale_only

Calibrate only the global scale and not all proportions

property locators_only

Calibrate only the locator offsets

property major_iter

Number of calibration loops to run

class pymomentum.marker_tracking.ModelOptions

Bases: pybind11_object

Model options to specify the template model, parameter transform and locator mappings

property locators

Path to locator mapping file e.g. character.locators

property model

Path to template model file with locators e.g. character.glb

property parameters

Path of parameter transform model file e.g. character.model

class pymomentum.marker_tracking.RefineConfig

Bases: TrackingConfig

Config for refining a tracked motion.

property calib_id

Calibrate identity parameters; default to False.

property calib_locators

Calibrate locator offsets; default to False.

property regularizer

Regularize the time-invariant parameters to prevent large changes.

class pymomentum.marker_tracking.TrackingConfig

Bases: BaseConfig

Config for the tracking optimization step

property collision_error_weight

Collision error weight; 0 to disable

property smoothing

Smoothing weight; 0 to disable

property smoothing_weights

Smoothing weights per model parameter. The size of this vector should be equal to number of model parameters and this overrides the value specific in smoothing

pymomentum.marker_tracking.process_marker_file(input_marker_file: str, output_file: str, tracking_config: pymomentum.marker_tracking.TrackingConfig, calibration_config: pymomentum.marker_tracking.CalibrationConfig, model_options: pymomentum.marker_tracking.ModelOptions, calibrate: bool, first_frame: int = 0, max_frames: int = 0) None
pymomentum.marker_tracking.process_markers(character: pymomentum.geometry.Character, identity: numpy.ndarray[numpy.float32[m, 1]], marker_data: list[list[pymomentum.geometry.Marker]], tracking_config: pymomentum.marker_tracking.TrackingConfig, calibration_config: pymomentum.marker_tracking.CalibrationConfig, calibrate: bool = True, first_frame: int = 0, max_frames: int = 0) numpy.ndarray[numpy.float32[m, n]]

process markers given character and identity.

Parameters:
  • character – Character to be used for tracking

  • identity – Identity parameters, pass in empty array for default identity

  • marker_data – A list of marker data for each frame

  • tracking_config – Tracking config to be used for tracking

  • calibration_config – Calibration config to be used for calibration

  • calibrate – Whether to calibrate the model

  • first_frame – First frame to be processed

  • max_frames – Max number of frames to be processed

Returns:

Transform parameters for each frame

pymomentum.marker_tracking.refine_motion(character: pymomentum.geometry.Character, identity: numpy.ndarray[numpy.float32[m, 1]], motion: numpy.ndarray[numpy.float32[m, n]], marker_data: list[list[pymomentum.geometry.Marker]], refine_config: pymomentum.marker_tracking.RefineConfig) numpy.ndarray[numpy.float32[m, n]]
pymomentum.marker_tracking.save_motion(out_file: str, character: pymomentum.geometry.Character, identity: numpy.ndarray[numpy.float32[m, 1]], motion: numpy.ndarray[numpy.float32[m, n]], marker_data: list[list[pymomentum.geometry.Marker]], fps: float, save_marker_mesh: bool = True) None