Jump to content

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

No edit summary
Line 18: Line 18:
* Apply: applies the integrator algorithm to the entry orientation data.
* Apply: applies the integrator algorithm to the entry orientation data.
* Reset: sets the initial orientation and its initial time to a desired value.
* Reset: sets the initial orientation and its initial time to 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.
* softengyro: This contains the result of integrating the initial orientation data, it contains a vector of orientation values represented as a Quaternion with their corresponding timestamps.
* interpolated: This contains a vector of interpolated orientation values with their corresponding interpolation timestamps.
* rawgyro: This parameter contains the data from sensors, could have data from gyroscope, accelerometer and magnetometer.
The user must take into account that the method uses the IInterpolator start time member to perform the interpolation and that the time must be set on microseconds.


<syntaxhighlight lang=c++>
<syntaxhighlight lang=c++>
RuntimeError ExampleInterpolator::Apply(
RuntimeError ExampleIntegrator::Apply(
     std::vector<std::pair<Quaternion<double>, uint64_t>>&interpolated,
     std::vector<std::pair<Quaternion<double>, uint64_t>>& softengyro,
     std::vector<std::pair<Quaternion<double>, uint64_t>>& softgyro) {
     const std::vector<SensorPayload> rawgyro) {
   RuntimeError ret{};
   RuntimeError ret{};


   /* Interpolation algorithm logic */
   /* Integrator algorithm logic */


   return ret;
   return ret;
Line 38: Line 38:


==== 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 receives an orientation value as parameter and a time value (in microseconds) as parameter and sets the IIntegrator initial orientation member and the initial time member.


<syntaxhighlight lang=c++>
<syntaxhighlight lang=c++>
RuntimeError ExampleInterpolator::Reset(const uint64_t start_time) {
RuntimeError SimpleComplementaryIntegrator::Reset(
    const Quaternion<double> initial_orient, const uint64_t initial_time) {
   RuntimeError ret{};
   RuntimeError ret{};


   /* Reset start time logic */
   /* Reset initial orientation and initial time logic */  
 
  this->initial_orient_ = /* logic result */;
  this->initial_time_ = /* logic result */;


   return ret;
   return ret;
Line 103: Line 107:
}
}
</syntaxhighlight>
</syntaxhighlight>


== Interpolator ==
== Interpolator ==
102

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.