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.
Describes motion model between two point clouds.
Describes RANSAC method parameters.
struct RansacParams
{
int size; // subset size
float thresh; // max error to classify as inlier
float eps; // max outliers ratio
float prob; // probability of success
RansacParams() : size(0), thresh(0), eps(0), prob(0) {}
RansacParams(int size, float thresh, float eps, float prob);
int niters() const;
static RansacParams default2dMotion(MotionModel model);
};
Returns: | RANSAC method empty parameters object. |
---|
Parameters: |
|
---|---|
Returns: | RANSAC method parameters object. |
Returns: | Number of iterations that’ll be performed by RANSAC method. |
---|
Parameters: |
|
---|---|
Returns: | Default RANSAC method parameters for the given motion model. |
Estimates best global motion between two 2D point clouds in the least-squares sense.
Note
Works in-place and changes input point arrays.
Parameters: |
|
---|---|
Returns: | 3x3 2D transformation matrix (32F). |
Estimates best global motion between two 2D point clouds robustly (using RANSAC method).
Parameters: |
|
---|
Computes motion between two frames assuming that all the intermediate motions are known.
Parameters: |
|
---|---|
Returns: | Motion from the frame from to the frame to. |
Base class for all global motion estimation methods.
class MotionEstimatorBase
{
public:
virtual ~MotionEstimatorBase();
virtual void setMotionModel(MotionModel val);
virtual MotionModel motionModel() const;
virtual Mat estimate(InputArray points0, InputArray points1, bool *ok = 0) = 0;
};
Sets motion model.
Parameters: |
|
---|
Returns: | Motion model. See videostab::MotionModel. |
---|
Estimates global motion between two 2D point clouds.
Parameters: |
|
---|---|
Returns: | 3x3 2D transformation matrix (32F). |
Describes a robust RANSAC-based global 2D motion estimation method which minimizes L2 error.
class MotionEstimatorRansacL2 : public MotionEstimatorBase
{
public:
MotionEstimatorRansacL2(MotionModel model = MM_AFFINE);
void setRansacParams(const RansacParams &val);
RansacParams ransacParams() const;
void setMinInlierRatio(float val);
float minInlierRatio() const;
virtual Mat estimate(InputArray points0, InputArray points1, bool *ok = 0);
};
Describes a global 2D motion estimation method which minimizes L1 error.
Note
To be able to use this method you must build OpenCV with CLP library support.
class MotionEstimatorL1 : public MotionEstimatorBase
{
public:
MotionEstimatorL1(MotionModel model = MM_AFFINE);
virtual Mat estimate(InputArray points0, InputArray points1, bool *ok = 0);
};
Base class for global 2D motion estimation methods which take frames as input.
class ImageMotionEstimatorBase
{
public:
virtual ~ImageMotionEstimatorBase();
virtual void setMotionModel(MotionModel val);
virtual MotionModel motionModel() const;
virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0) = 0;
};
Describes a global 2D motion estimation method which uses keypoints detection and optical flow for matching.
class KeypointBasedMotionEstimator : public ImageMotionEstimatorBase
{
public:
KeypointBasedMotionEstimator(Ptr<MotionEstimatorBase> estimator);
virtual void setMotionModel(MotionModel val);
virtual MotionModel motionModel() const;
void setDetector(Ptr<FeatureDetector> val);
Ptr<FeatureDetector> detector() const;
void setOpticalFlowEstimator(Ptr<ISparseOptFlowEstimator> val);
Ptr<ISparseOptFlowEstimator> opticalFlowEstimator() const;
void setOutlierRejector(Ptr<IOutlierRejector> val);
Ptr<IOutlierRejector> outlierRejector() const;
virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0);
};