RidgeRun Video Stabilization Library/API Reference/Adding Algorithms: Difference between revisions

Line 117: Line 117:
The RidgeRun Interpolator Interface, known as IInterpolator, is an extensible class design to support various types of interpolators. To add a new interpolator to it, the user must implement a new interpolator class that derives from the IInterpolator class. This class must implement the following methods:
The RidgeRun Interpolator Interface, known as IInterpolator, is an extensible class design to support various types of interpolators. To add a new interpolator to it, the user must implement a new interpolator class that derives from the IInterpolator class. This class must implement the following methods:
* Apply: applies the interpolator algorithm to the desired data based on a initial time.
* Apply: applies the interpolator algorithm to the desired data based on a initial time.
* Reset: sets the initial time of the interpolator to the desired value.
* Reset: resets the initial time of the interpolator based on a desired value.


==== Defining the Apply method ====
==== Defining the Apply method ====
This method receives two parameters:  
This method receives two parameters:  
* softgyro: This is the input data containing a vector of orientation values (Quaternions) along with their corresponding timestamps. It is used by the interpolation algorithm.
* softgyro: This is the input data containing a vector of orientation values (Quaternions) along with their corresponding timestamps (in microseconds). It is used by the interpolation algorithm.
* interpolated: This contains a vector of interpolated orientation values with their corresponding interpolation timestamps.
* interpolated: This contains a vector of interpolated orientation values with their corresponding interpolation timestamps (in microseconds).
The user must that into account that the time are handled in microseconds.


<syntaxhighlight lang=c++>
<syntaxhighlight lang=c++>
Line 137: Line 136:


==== Defining the Reset method ====
==== Defining the Reset method ====
This method receives an start time value as parameter and sets the IInterpolator start time member to the inserted value.
This method resets the interpolation based on an start time value inserted as parameter.
 
<syntaxhighlight lang=c++>
<syntaxhighlight lang=c++>
RuntimeError ExampleInterpolator::Reset(const uint64_t start_time) {
RuntimeError ExampleInterpolator::Reset(const uint64_t start_time) {
102

edits