![]() |
ImFusion C++ SDK 4.4.0
|
#include <ImFusion/US/MotionTrajectoryModel.h>
Motion model with independent poses for each frame, exposing only one frame at a time for optimization. More...
Motion model with independent poses for each frame, exposing only one frame at a time for optimization.
This model maintains a pose (as a transformation matrix) for each frame in the range [0, m_size). Only the parameters of the currently focused frame are accessible.
Coordinate systems for motion can be chosen using CoordinateMode:
The model uses the averaging interval to define the radius of the sliding window for the estimated trajectory direction. For each frame, an amount equal to m_averageInterval of matrices from the fitted motion is taken before and after the currently estimated frame, and the average motion is calculated for the motion within this interval.
For example, for fitted motion of size 100: For the frame at position i = 20 and m_averageInterval = 5, the average motion in the range [15, 25] will be calculated.
Public Types | |
| enum class | CoordinateMode : int { Global = 0 , ImagePlane = 1 , Trajectory = 2 } |
| Coordinate system of optimization (only relevant for restricted movement, e.g. in image plane direction). More... | |
| Public Types inherited from ImFusion::US::MotionTrajectoryModel | |
| typedef std::function< MotionTrajectoryModel *(int)> | createModelFunc |
| Function signature for creating a motion model with a given size. | |
Public Member Functions | |
| EveryFrameModel (int size, int focus=0) | |
| std::string | name () const override |
| Returns the name of the current motion model. | |
| int | numberOfParameters () const override |
| std::vector< double > | parameters () const override |
| void | setParameters (const std::vector< double > &pars) override |
| Sets pose parameters for the currently focused frame. | |
| std::vector< mat4 > | defineMotion () const override |
| Defines the motion trajectory across all frames. | |
| mat4 | fitMatrices (const std::vector< mat4 > &mat) override |
| Fit motion parameters to a sequence of pose matrices. | |
| void | setFocus (int f) |
| int | focus () const |
| void | setMatrix (const mat4 &m, int which) |
Sets the parameters of the waypoint with index which from the transformation matrix. | |
| mat4 | matrix (int which) const |
| Retrieves the transformation matrix for a specified frame. | |
| void | setAverageInterval (int ai) |
| Sets the number of frames to average for estimating trajectory direction. | |
| int | averageInterval () const |
| Gets the averaging interval used for trajectory estimation. | |
| void | setCoordinateMode (CoordinateMode mode) |
| CoordinateMode | coordinateMode () const |
| Public Member Functions inherited from ImFusion::US::MotionTrajectoryModel | |
| MotionTrajectoryModel (int size) | |
| void | setRelativeShiftMatrix (const mat4 &relShiftBefore) |
| Sets the relative shift matrix applied before the motion. | |
| void | configure (const Properties *p) override |
| Sets one or multiple properties. | |
| void | configuration (Properties *p) const override |
| Retrieve the properties of this object. | |
| Public Member Functions inherited from ImFusion::Configurable | |
| virtual void | configureDefaults () |
| Retrieve the properties of this object, replaces values with their defaults and sets it again. | |
| void | registerParameter (ParameterBase *param) |
| Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration(). | |
| void | unregisterParameter (const ParameterBase *param) |
| Remove the given Parameter or SubProperty from the list of registered parameters. | |
| Configurable (const Configurable &rhs) | |
| Configurable (Configurable &&rhs) noexcept | |
| Configurable & | operator= (const Configurable &) |
| Configurable & | operator= (Configurable &&) noexcept |
Protected Attributes | |
| int | m_focus |
| Current frame the exposed parameters correspond to. | |
| std::vector< mat4 > | m_relativeMatrices |
| Matrices to set transformation in desired local coordinate system. | |
| std::vector< mat4 > | m_originalMatrices |
| Original tracking matrices. | |
| CoordinateMode | m_coordMode = CoordinateMode::Global |
| int | m_averageInterval = 1 |
| Averaging interval to average trajectory direction. | |
| Protected Attributes inherited from ImFusion::US::MotionTrajectoryModel | |
| const int | m_size |
| Size of the model, regularly the number of frames. | |
| std::vector< double > | m_pars |
| Full motion parameter vector - not necessarily the exposed ones. | |
| mat4 | m_relShift |
| Generic helper matrix to incorporate optional shifts. Considered by rigidMotion(). | |
| Protected Attributes inherited from ImFusion::Configurable | |
| std::vector< Param > | m_params |
| List of all registered Parameter and SubProperty instances. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from ImFusion::US::MotionTrajectoryModel | |
| static std::vector< std::pair< std::string, createModelFunc > > & | supportedModels () |
| Returns a list of supported motion models. | |
| Public Attributes inherited from ImFusion::Configurable | |
| Signal | signalParametersChanged |
| Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
| Protected Member Functions inherited from ImFusion::US::MotionTrajectoryModel | |
| std::vector< mat4 > | rigidMotion (const mat4 &m0, const mat4 &m1, int startFrame=0, int endFrame=-1) const |
| Helper method to interpolate a rigid motion between m0 and m1. | |
|
strong |
Coordinate system of optimization (only relevant for restricted movement, e.g. in image plane direction).
|
explicit |
| size | number of frames in the motion sequence. |
| focus | index of currently focused frame |
|
inlineoverridevirtual |
Returns the name of the current motion model.
Implements ImFusion::US::MotionTrajectoryModel.
|
inlineoverridevirtual |
Accessors for the exposed parameters. Default implement access the full vector m_pars, but derived classes may choose to only expose some of them depending on some internal state.
Reimplemented from ImFusion::US::MotionTrajectoryModel.
|
overridevirtual |
Reimplemented from ImFusion::US::MotionTrajectoryModel.
|
overridevirtual |
Sets pose parameters for the currently focused frame.
Only 6 elements in the input vector are assumed.
| pars | 6-element vector representing the pose parameters (assumed to be a 6D vector: translation + Euler angles). |
Reimplemented from ImFusion::US::MotionTrajectoryModel.
|
overridevirtual |
Defines the motion trajectory across all frames.
Computes the transformation matrix for each frame based on the current coordinate mode.
Implements ImFusion::US::MotionTrajectoryModel.
|
overridevirtual |
Fit motion parameters to a sequence of pose matrices.
Computes and sets internal parameters to approximate the given trajectory, and returns a registration matrix to align the model to the input poses.
| mat | Pose waypoints as 4x4 matrices, using the TOWORLD convention. |
Implements ImFusion::US::MotionTrajectoryModel.
| mat4 ImFusion::US::EveryFrameModel::matrix | ( | int | which | ) | const |
Retrieves the transformation matrix for a specified frame.
If the index is out of range, returns mat4::Identity().
| void ImFusion::US::EveryFrameModel::setAverageInterval | ( | int | ai | ) |
Sets the number of frames to average for estimating trajectory direction.
| ai | Averaging interval (number of frames). |