Global Motion Estimation#

Detailed Description#

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.

Classes#

Name

Description

class cv::videostab::FromFileMotionReader

View details

class cv::videostab::GaussianMotionFilter

View details

class cv::videostab::ImageMotionEstimatorBase

Base class for global 2D motion estimation methods which take frames as input. View details

class cv::videostab::IMotionStabilizer

View details

class cv::videostab::KeypointBasedMotionEstimator

Describes a global 2D motion estimation method which uses keypoints detection and optical flow for matching. View details

class cv::videostab::LpMotionStabilizer

View details

class cv::videostab::MotionEstimatorBase

Base class for all global motion estimation methods. View details

class cv::videostab::MotionEstimatorL1

Describes a global 2D motion estimation method which minimizes L1 error. View details

class cv::videostab::MotionEstimatorRansacL2

Describes a robust RANSAC-based global 2D motion estimation method which minimizes L2 error. View details

class cv::videostab::MotionFilterBase

View details

class cv::videostab::MotionStabilizationPipeline

View details

struct cv::videostab::RansacParams

Describes RANSAC method parameters. View details

class cv::videostab::ToFileMotionWriter

View details

Enumerations#

Describes motion model between two point clouds. View details

Functions#

Return

Name

Description

cv::GaussianMotionFilter(
int radius = 15,
float stdev = -1.f )

cv::RansacParams(
int size,
float thresh,
float eps,
float prob )

Constructor.

Mat

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

Mat

cv::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.

Mat

cv::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).

float

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

Mat

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

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

Enumeration Type Documentation#

MotionModel#

enum cv::videostab::MotionModel

#include <opencv2/videostab/motion_core.hpp>

Describes motion model between two point clouds.

Enumerator:

MM_TRANSLATION

MM_TRANSLATION_AND_SCALE

MM_ROTATION

MM_RIGID

MM_SIMILARITY

MM_AFFINE

MM_HOMOGRAPHY

MM_UNKNOWN

Function Documentation#

ensureInclusionConstraint()#

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

#include <opencv2/videostab/motion_stabilizing.hpp>

estimateGlobalMotionLeastSquares()#

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

#include <opencv2/videostab/global_motion.hpp>

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

Note

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).

estimateGlobalMotionRansac()#

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 )

#include <opencv2/videostab/global_motion.hpp>

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.

estimateOptimalTrimRatio()#

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

#include <opencv2/videostab/motion_stabilizing.hpp>

getMotion()#

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

#include <opencv2/videostab/global_motion.hpp>

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 Source frame to the Destination frame.

Here is the call graph for this function:

cv::videostab::getMotion Node1 cv::videostab::getMotion Node1->Node1

cv::videostab::getMotion Node1 cv::videostab::getMotion Node1->Node1