Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
app_utils.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#pragma once
9
13
14#include <CLI/CLI.hpp>
15
16namespace momentum {
17
18struct IOOptions {
19 std::string inputFile;
20 std::string outputFile;
21};
22
24 std::string model;
25 std::string parameters;
26 std::string locators;
27};
28
29void addIOOptions(CLI::App& app, std::shared_ptr<IOOptions> ioOptions);
30void addModelOptions(CLI::App& app, std::shared_ptr<ModelOptions> modelOptions);
31void addCalibrationOptions(CLI::App& app, std::shared_ptr<CalibrationConfig> config);
32void addTrackingOptions(CLI::App& app, std::shared_ptr<TrackingConfig> config);
33void addRefineOptions(CLI::App& app, std::shared_ptr<RefineConfig> config);
34
35std::tuple<momentum::Character, momentum::ModelParameters> loadCalibratedModel(
36 const std::string& modelFile);
37
38std::tuple<momentum::Character, momentum::ModelParameters> loadCharacterWithIdentity(
39 const ModelOptions& modelFiles);
40
54void saveMotion(
55 const std::string& outFile,
56 const momentum::Character& character,
57 const momentum::ModelParameters& identity,
58 Eigen::MatrixXf& finalMotion,
59 std::span<const std::vector<momentum::Marker>> markerData,
60 double fps,
61 bool saveMarkerMesh = true,
62 std::span<const int64_t> timestamps = {});
63
64} // namespace momentum
std::tuple< momentum::Character, momentum::ModelParameters > loadCalibratedModel(const std::string &modelFile)
void addRefineOptions(CLI::App &app, std::shared_ptr< RefineConfig > config)
void addTrackingOptions(CLI::App &app, std::shared_ptr< TrackingConfig > config)
void addIOOptions(CLI::App &app, std::shared_ptr< IOOptions > ioOptions)
Definition app_utils.cpp:26
void addCalibrationOptions(CLI::App &app, std::shared_ptr< CalibrationConfig > config)
Definition app_utils.cpp:44
void saveMotion(const std::string &outFile, const momentum::Character &character, const momentum::ModelParameters &identity, Eigen::MatrixXf &finalMotion, std::span< const std::vector< momentum::Marker > > markerData, const double fps, const bool saveMarkerMesh, std::span< const int64_t > timestamps)
Save the given character and motion to a GLB or FBX file.
ModelParametersT< float > ModelParameters
Definition types.h:105
std::tuple< momentum::Character, momentum::ModelParameters > loadCharacterWithIdentity(const ModelOptions &modelFiles)
void addModelOptions(CLI::App &app, std::shared_ptr< ModelOptions > modelOptions)
Definition app_utils.cpp:35
A character model with skeletal structure, mesh, and optional components.
Definition character.h:32
std::string inputFile
Definition app_utils.h:19
std::string outputFile
Definition app_utils.h:20
std::string locators
Definition app_utils.h:26
std::string parameters
Definition app_utils.h:25