Global Motion Estimation

Overview

The video stabilization module contains a set of functions and classes for global motion estimation between point clouds or between images. Moreā€¦

// enums

enum cv::videostab::MotionModel;

// structs

struct cv::videostab::RansacParams;

// classes

class cv::videostab::FromFileMotionReader;
class cv::videostab::GaussianMotionFilter;
class cv::videostab::IMotionStabilizer;
class cv::videostab::ImageMotionEstimatorBase;
class cv::videostab::KeypointBasedMotionEstimator;
class cv::videostab::LpMotionStabilizer;
class cv::videostab::MotionEstimatorBase;
class cv::videostab::MotionEstimatorL1;
class cv::videostab::MotionEstimatorRansacL2;
class cv::videostab::MotionFilterBase;
class cv::videostab::MotionStabilizationPipeline;
class cv::videostab::ToFileMotionWriter;

// global functions

Mat
cv::videostab::ensureInclusionConstraint(
    const Mat& M,
    Size size,
    float trimRatio
    );

Mat
cv::videostab::estimateGlobalMotionLeastSquares(
    InputOutputArray points0,
    InputOutputArray points1,
    int model = MM_AFFINE,
    float* rmse = 0
    );

Mat
cv::videostab::estimateGlobalMotionRansac(
    InputArray points0,
    InputArray points1,
    int model = MM_AFFINE,
    const RansacParams& params = RansacParams::default2dMotion(MM_AFFINE),
    float* rmse = 0,
    int* ninliers = 0
    );

float
cv::videostab::estimateOptimalTrimRatio(
    const Mat& M,
    Size size
    );

Mat
cv::videostab::getMotion(
    int from,
    int to,
    const std::vector<Mat>& motions
    );

Detailed Documentation

The video stabilization module contains a set of functions and classes for global motion estimation between point clouds or between images. In the last case features are extracted and matched internally. For the sake of convenience the motion estimation functions are wrapped into classes. Both the functions and the classes are available.

Global Functions

Mat
cv::videostab::estimateGlobalMotionLeastSquares(
    InputOutputArray points0,
    InputOutputArray points1,
    int model = MM_AFFINE,
    float* rmse = 0
    )

Estimates best global motion between two 2D point clouds in the least-squares sense.

Works in-place and changes input point arrays.

Parameters:

points0 Source set of 2D points (32F).
points1 Destination set of 2D points (32F).
model Motion model (up to MM_AFFINE).
rmse Final root-mean-square error.

Returns:

3x3 2D transformation matrix (32F).

Mat
cv::videostab::estimateGlobalMotionRansac(
    InputArray points0,
    InputArray points1,
    int model = MM_AFFINE,
    const RansacParams& params = RansacParams::default2dMotion(MM_AFFINE),
    float* rmse = 0,
    int* ninliers = 0
    )

Estimates best global motion between two 2D point clouds robustly (using RANSAC method).

Parameters:

points0 Source set of 2D points (32F).
points1 Destination set of 2D points (32F).
model Motion model. See cv::videostab::MotionModel.
params RANSAC method parameters. See videostab::RansacParams.
rmse Final root-mean-square error.
ninliers Final number of inliers.
Mat
cv::videostab::getMotion(
    int from,
    int to,
    const std::vector<Mat>& motions
    )

Computes motion between two frames assuming that all the intermediate motions are known.

Parameters:

from Source frame index.
to Destination frame index.
motions Pair-wise motions. motions[i] denotes motion from the frame i to the frame i+1

Returns:

Motion from the frame from to the frame to.