version:2.1.5

bugfixes:
update:拨号使用ocr进行识别
This commit is contained in:
2025-05-22 14:30:12 +08:00
parent a86592005f
commit d7e830985f
226 changed files with 66016 additions and 81139 deletions

View File

@@ -46,7 +46,8 @@
#include "opencv2/core.hpp"
namespace cv {
namespace cv
{
//! @addtogroup video_motion
//! @{
@@ -56,29 +57,29 @@ namespace cv {
The class is only used to define the common interface for the whole family of background/foreground
segmentation algorithms.
*/
class CV_EXPORTS_W BackgroundSubtractor : public Algorithm {
public:
/** @brief Computes a foreground mask.
class CV_EXPORTS_W BackgroundSubtractor : public Algorithm
{
public:
/** @brief Computes a foreground mask.
@param image Next video frame.
@param fgmask The output foreground mask as an 8-bit binary image.
@param learningRate The value between 0 and 1 that indicates how fast the background model is
learnt. Negative parameter value makes the algorithm to use some automatically chosen learning
rate. 0 means that the background model is not updated at all, 1 means that the background model
is completely reinitialized from the last frame.
*/
CV_WRAP virtual void
apply(InputArray image, OutputArray fgmask, double learningRate = -1) = 0;
@param image Next video frame.
@param fgmask The output foreground mask as an 8-bit binary image.
@param learningRate The value between 0 and 1 that indicates how fast the background model is
learnt. Negative parameter value makes the algorithm to use some automatically chosen learning
rate. 0 means that the background model is not updated at all, 1 means that the background model
is completely reinitialized from the last frame.
*/
CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) = 0;
/** @brief Computes a background image.
/** @brief Computes a background image.
@param backgroundImage The output background image.
@param backgroundImage The output background image.
@note Sometimes the background image can be very blurry, as it contain the average background
statistics.
*/
CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const = 0;
};
@note Sometimes the background image can be very blurry, as it contain the average background
statistics.
*/
CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const = 0;
};
/** @brief Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
@@ -86,128 +87,126 @@ segmentation algorithms.
The class implements the Gaussian mixture model background subtraction described in @cite Zivkovic2004
and @cite Zivkovic2006 .
*/
class CV_EXPORTS_W BackgroundSubtractorMOG2 : public BackgroundSubtractor {
public:
/** @brief Returns the number of last frames that affect the background model
*/
CV_WRAP virtual int getHistory() const = 0;
/** @brief Sets the number of last frames that affect the background model
*/
CV_WRAP virtual void setHistory(int history) = 0;
class CV_EXPORTS_W BackgroundSubtractorMOG2 : public BackgroundSubtractor
{
public:
/** @brief Returns the number of last frames that affect the background model
*/
CV_WRAP virtual int getHistory() const = 0;
/** @brief Sets the number of last frames that affect the background model
*/
CV_WRAP virtual void setHistory(int history) = 0;
/** @brief Returns the number of gaussian components in the background model
*/
CV_WRAP virtual int getNMixtures() const = 0;
/** @brief Sets the number of gaussian components in the background model.
/** @brief Returns the number of gaussian components in the background model
*/
CV_WRAP virtual int getNMixtures() const = 0;
/** @brief Sets the number of gaussian components in the background model.
The model needs to be reinitalized to reserve memory.
*/
CV_WRAP virtual void setNMixtures(int nmixtures) = 0;//needs reinitialization!
The model needs to be reinitalized to reserve memory.
*/
CV_WRAP virtual void setNMixtures(int nmixtures) = 0;//needs reinitialization!
/** @brief Returns the "background ratio" parameter of the algorithm
/** @brief Returns the "background ratio" parameter of the algorithm
If a foreground pixel keeps semi-constant value for about backgroundRatio\*history frames, it's
considered background and added to the model as a center of a new component. It corresponds to TB
parameter in the paper.
*/
CV_WRAP virtual double getBackgroundRatio() const = 0;
/** @brief Sets the "background ratio" parameter of the algorithm
*/
CV_WRAP virtual void setBackgroundRatio(double ratio) = 0;
If a foreground pixel keeps semi-constant value for about backgroundRatio\*history frames, it's
considered background and added to the model as a center of a new component. It corresponds to TB
parameter in the paper.
*/
CV_WRAP virtual double getBackgroundRatio() const = 0;
/** @brief Sets the "background ratio" parameter of the algorithm
*/
CV_WRAP virtual void setBackgroundRatio(double ratio) = 0;
/** @brief Returns the variance threshold for the pixel-model match
/** @brief Returns the variance threshold for the pixel-model match
The main threshold on the squared Mahalanobis distance to decide if the sample is well described by
the background model or not. Related to Cthr from the paper.
*/
CV_WRAP virtual double getVarThreshold() const = 0;
/** @brief Sets the variance threshold for the pixel-model match
*/
CV_WRAP virtual void setVarThreshold(double varThreshold) = 0;
The main threshold on the squared Mahalanobis distance to decide if the sample is well described by
the background model or not. Related to Cthr from the paper.
*/
CV_WRAP virtual double getVarThreshold() const = 0;
/** @brief Sets the variance threshold for the pixel-model match
*/
CV_WRAP virtual void setVarThreshold(double varThreshold) = 0;
/** @brief Returns the variance threshold for the pixel-model match used for new mixture component generation
/** @brief Returns the variance threshold for the pixel-model match used for new mixture component generation
Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the
existing components (corresponds to Tg in the paper). If a pixel is not close to any component, it
is considered foreground or added as a new component. 3 sigma =\> Tg=3\*3=9 is default. A smaller Tg
value generates more components. A higher Tg value may result in a small number of components but
they can grow too large.
*/
CV_WRAP virtual double getVarThresholdGen() const = 0;
/** @brief Sets the variance threshold for the pixel-model match used for new mixture component generation
*/
CV_WRAP virtual void setVarThresholdGen(double varThresholdGen) = 0;
Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the
existing components (corresponds to Tg in the paper). If a pixel is not close to any component, it
is considered foreground or added as a new component. 3 sigma =\> Tg=3\*3=9 is default. A smaller Tg
value generates more components. A higher Tg value may result in a small number of components but
they can grow too large.
*/
CV_WRAP virtual double getVarThresholdGen() const = 0;
/** @brief Sets the variance threshold for the pixel-model match used for new mixture component generation
*/
CV_WRAP virtual void setVarThresholdGen(double varThresholdGen) = 0;
/** @brief Returns the initial variance of each gaussian component
*/
CV_WRAP virtual double getVarInit() const = 0;
/** @brief Sets the initial variance of each gaussian component
*/
CV_WRAP virtual void setVarInit(double varInit) = 0;
/** @brief Returns the initial variance of each gaussian component
*/
CV_WRAP virtual double getVarInit() const = 0;
/** @brief Sets the initial variance of each gaussian component
*/
CV_WRAP virtual void setVarInit(double varInit) = 0;
CV_WRAP virtual double getVarMin() const = 0;
CV_WRAP virtual double getVarMin() const = 0;
CV_WRAP virtual void setVarMin(double varMin) = 0;
CV_WRAP virtual void setVarMin(double varMin) = 0;
CV_WRAP virtual double getVarMax() const = 0;
CV_WRAP virtual void setVarMax(double varMax) = 0;
CV_WRAP virtual double getVarMax() const = 0;
/** @brief Returns the complexity reduction threshold
CV_WRAP virtual void setVarMax(double varMax) = 0;
This parameter defines the number of samples needed to accept to prove the component exists. CT=0.05
is a default value for all the samples. By setting CT=0 you get an algorithm very similar to the
standard Stauffer&Grimson algorithm.
*/
CV_WRAP virtual double getComplexityReductionThreshold() const = 0;
/** @brief Sets the complexity reduction threshold
*/
CV_WRAP virtual void setComplexityReductionThreshold(double ct) = 0;
/** @brief Returns the complexity reduction threshold
/** @brief Returns the shadow detection flag
This parameter defines the number of samples needed to accept to prove the component exists. CT=0.05
is a default value for all the samples. By setting CT=0 you get an algorithm very similar to the
standard Stauffer&Grimson algorithm.
*/
CV_WRAP virtual double getComplexityReductionThreshold() const = 0;
/** @brief Sets the complexity reduction threshold
*/
CV_WRAP virtual void setComplexityReductionThreshold(double ct) = 0;
If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorMOG2 for
details.
*/
CV_WRAP virtual bool getDetectShadows() const = 0;
/** @brief Enables or disables shadow detection
*/
CV_WRAP virtual void setDetectShadows(bool detectShadows) = 0;
/** @brief Returns the shadow detection flag
/** @brief Returns the shadow value
If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorMOG2 for
details.
*/
CV_WRAP virtual bool getDetectShadows() const = 0;
/** @brief Enables or disables shadow detection
*/
CV_WRAP virtual void setDetectShadows(bool detectShadows) = 0;
Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0
in the mask always means background, 255 means foreground.
*/
CV_WRAP virtual int getShadowValue() const = 0;
/** @brief Sets the shadow value
*/
CV_WRAP virtual void setShadowValue(int value) = 0;
/** @brief Returns the shadow value
/** @brief Returns the shadow threshold
Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0
in the mask always means background, 255 means foreground.
*/
CV_WRAP virtual int getShadowValue() const = 0;
/** @brief Sets the shadow value
*/
CV_WRAP virtual void setShadowValue(int value) = 0;
A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in
the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel
is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara,
*Detecting Moving Shadows...*, IEEE PAMI,2003.
*/
CV_WRAP virtual double getShadowThreshold() const = 0;
/** @brief Sets the shadow threshold
*/
CV_WRAP virtual void setShadowThreshold(double threshold) = 0;
/** @brief Returns the shadow threshold
/** @brief Computes a foreground mask.
A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in
the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel
is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara,
*Detecting Moving Shadows...*, IEEE PAMI,2003.
*/
CV_WRAP virtual double getShadowThreshold() const = 0;
/** @brief Sets the shadow threshold
*/
CV_WRAP virtual void setShadowThreshold(double threshold) = 0;
/** @brief Computes a foreground mask.
@param image Next video frame. Floating point frame will be used without scaling and should be in range \f$[0,255]\f$.
@param fgmask The output foreground mask as an 8-bit binary image.
@param learningRate The value between 0 and 1 that indicates how fast the background model is
learnt. Negative parameter value makes the algorithm to use some automatically chosen learning
rate. 0 means that the background model is not updated at all, 1 means that the background model
is completely reinitialized from the last frame.
*/
CV_WRAP virtual void
apply(InputArray image, OutputArray fgmask, double learningRate = -1) CV_OVERRIDE = 0;
};
@param image Next video frame. Floating point frame will be used without scaling and should be in range \f$[0,255]\f$.
@param fgmask The output foreground mask as an 8-bit binary image.
@param learningRate The value between 0 and 1 that indicates how fast the background model is
learnt. Negative parameter value makes the algorithm to use some automatically chosen learning
rate. 0 means that the background model is not updated at all, 1 means that the background model
is completely reinitialized from the last frame.
*/
CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) CV_OVERRIDE = 0;
};
/** @brief Creates MOG2 Background Subtractor
@@ -218,85 +217,86 @@ affect the background update.
@param detectShadows If true, the algorithm will detect shadows and mark them. It decreases the
speed a bit, so if you do not need this feature, set the parameter to false.
*/
CV_EXPORTS_W Ptr <BackgroundSubtractorMOG2>
createBackgroundSubtractorMOG2(int history = 500, double varThreshold = 16,
bool detectShadows = true);
CV_EXPORTS_W Ptr<BackgroundSubtractorMOG2>
createBackgroundSubtractorMOG2(int history=500, double varThreshold=16,
bool detectShadows=true);
/** @brief K-nearest neighbours - based Background/Foreground Segmentation Algorithm.
The class implements the K-nearest neighbours background subtraction described in @cite Zivkovic2006 .
Very efficient if number of foreground pixels is low.
*/
class CV_EXPORTS_W BackgroundSubtractorKNN : public BackgroundSubtractor {
public:
/** @brief Returns the number of last frames that affect the background model
*/
CV_WRAP virtual int getHistory() const = 0;
/** @brief Sets the number of last frames that affect the background model
*/
CV_WRAP virtual void setHistory(int history) = 0;
class CV_EXPORTS_W BackgroundSubtractorKNN : public BackgroundSubtractor
{
public:
/** @brief Returns the number of last frames that affect the background model
*/
CV_WRAP virtual int getHistory() const = 0;
/** @brief Sets the number of last frames that affect the background model
*/
CV_WRAP virtual void setHistory(int history) = 0;
/** @brief Returns the number of data samples in the background model
*/
CV_WRAP virtual int getNSamples() const = 0;
/** @brief Sets the number of data samples in the background model.
/** @brief Returns the number of data samples in the background model
*/
CV_WRAP virtual int getNSamples() const = 0;
/** @brief Sets the number of data samples in the background model.
The model needs to be reinitalized to reserve memory.
*/
CV_WRAP virtual void setNSamples(int _nN) = 0;//needs reinitialization!
The model needs to be reinitalized to reserve memory.
*/
CV_WRAP virtual void setNSamples(int _nN) = 0;//needs reinitialization!
/** @brief Returns the threshold on the squared distance between the pixel and the sample
/** @brief Returns the threshold on the squared distance between the pixel and the sample
The threshold on the squared distance between the pixel and the sample to decide whether a pixel is
close to a data sample.
*/
CV_WRAP virtual double getDist2Threshold() const = 0;
/** @brief Sets the threshold on the squared distance
*/
CV_WRAP virtual void setDist2Threshold(double _dist2Threshold) = 0;
The threshold on the squared distance between the pixel and the sample to decide whether a pixel is
close to a data sample.
*/
CV_WRAP virtual double getDist2Threshold() const = 0;
/** @brief Sets the threshold on the squared distance
*/
CV_WRAP virtual void setDist2Threshold(double _dist2Threshold) = 0;
/** @brief Returns the number of neighbours, the k in the kNN.
/** @brief Returns the number of neighbours, the k in the kNN.
K is the number of samples that need to be within dist2Threshold in order to decide that that
pixel is matching the kNN background model.
*/
CV_WRAP virtual int getkNNSamples() const = 0;
/** @brief Sets the k in the kNN. How many nearest neighbours need to match.
*/
CV_WRAP virtual void setkNNSamples(int _nkNN) = 0;
K is the number of samples that need to be within dist2Threshold in order to decide that that
pixel is matching the kNN background model.
*/
CV_WRAP virtual int getkNNSamples() const = 0;
/** @brief Sets the k in the kNN. How many nearest neighbours need to match.
*/
CV_WRAP virtual void setkNNSamples(int _nkNN) = 0;
/** @brief Returns the shadow detection flag
/** @brief Returns the shadow detection flag
If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorKNN for
details.
*/
CV_WRAP virtual bool getDetectShadows() const = 0;
/** @brief Enables or disables shadow detection
*/
CV_WRAP virtual void setDetectShadows(bool detectShadows) = 0;
If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorKNN for
details.
*/
CV_WRAP virtual bool getDetectShadows() const = 0;
/** @brief Enables or disables shadow detection
*/
CV_WRAP virtual void setDetectShadows(bool detectShadows) = 0;
/** @brief Returns the shadow value
/** @brief Returns the shadow value
Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0
in the mask always means background, 255 means foreground.
*/
CV_WRAP virtual int getShadowValue() const = 0;
/** @brief Sets the shadow value
*/
CV_WRAP virtual void setShadowValue(int value) = 0;
Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0
in the mask always means background, 255 means foreground.
*/
CV_WRAP virtual int getShadowValue() const = 0;
/** @brief Sets the shadow value
*/
CV_WRAP virtual void setShadowValue(int value) = 0;
/** @brief Returns the shadow threshold
/** @brief Returns the shadow threshold
A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in
the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel
is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara,
*Detecting Moving Shadows...*, IEEE PAMI,2003.
*/
CV_WRAP virtual double getShadowThreshold() const = 0;
/** @brief Sets the shadow threshold
*/
CV_WRAP virtual void setShadowThreshold(double threshold) = 0;
};
A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in
the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel
is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara,
*Detecting Moving Shadows...*, IEEE PAMI,2003.
*/
CV_WRAP virtual double getShadowThreshold() const = 0;
/** @brief Sets the shadow threshold
*/
CV_WRAP virtual void setShadowThreshold(double threshold) = 0;
};
/** @brief Creates KNN Background Subtractor
@@ -306,9 +306,9 @@ whether a pixel is close to that sample. This parameter does not affect the back
@param detectShadows If true, the algorithm will detect shadows and mark them. It decreases the
speed a bit, so if you do not need this feature, set the parameter to false.
*/
CV_EXPORTS_W Ptr <BackgroundSubtractorKNN>
createBackgroundSubtractorKNN(int history = 500, double dist2Threshold = 400.0,
bool detectShadows = true);
CV_EXPORTS_W Ptr<BackgroundSubtractorKNN>
createBackgroundSubtractorKNN(int history=500, double dist2Threshold=400.0,
bool detectShadows=true);
//! @} video_motion

View File

@@ -5,7 +5,8 @@
#ifndef OPENCV_VIDEO_LEGACY_CONSTANTS_H
#define OPENCV_VIDEO_LEGACY_CONSTANTS_H
enum {
enum
{
CV_LKFLOW_PYR_A_READY = 1,
CV_LKFLOW_PYR_B_READY = 2,
CV_LKFLOW_INITIAL_GUESSES = 4,

View File

@@ -47,16 +47,16 @@
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
namespace cv {
namespace cv
{
//! @addtogroup video_track
//! @{
enum {
OPTFLOW_USE_INITIAL_FLOW = 4,
OPTFLOW_LK_GET_MIN_EIGENVALS = 8,
OPTFLOW_FARNEBACK_GAUSSIAN = 256
};
enum { OPTFLOW_USE_INITIAL_FLOW = 4,
OPTFLOW_LK_GET_MIN_EIGENVALS = 8,
OPTFLOW_FARNEBACK_GAUSSIAN = 256
};
/** @brief Finds an object center, size, and orientation.
@@ -76,8 +76,8 @@ See the OpenCV sample camshiftdemo.c that tracks colored objects.
- (Python) A sample explaining the camshift tracking algorithm can be found at
opencv_source_code/samples/python/camshift.py
*/
CV_EXPORTS_W RotatedRect CamShift(InputArray probImage, CV_IN_OUT Rect &window,
TermCriteria criteria);
CV_EXPORTS_W RotatedRect CamShift( InputArray probImage, CV_IN_OUT Rect& window,
TermCriteria criteria );
/** @example samples/cpp/camshiftdemo.cpp
An example using the mean-shift tracking algorithm
*/
@@ -101,7 +101,7 @@ with findContours , throwing away contours with small area ( contourArea ), and
remaining contours with drawContours.
*/
CV_EXPORTS_W int meanShift(InputArray probImage, CV_IN_OUT Rect &window, TermCriteria criteria);
CV_EXPORTS_W int meanShift( InputArray probImage, CV_IN_OUT Rect& window, TermCriteria criteria );
/** @brief Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.
@@ -118,12 +118,11 @@ constructed without the gradients then calcOpticalFlowPyrLK will calculate them
to force data copying.
@return number of levels in constructed pyramid. Can be less than maxLevel.
*/
CV_EXPORTS_W int buildOpticalFlowPyramid(InputArray img, OutputArrayOfArrays pyramid,
Size winSize, int maxLevel,
bool withDerivatives = true,
int pyrBorder = BORDER_REFLECT_101,
int derivBorder = BORDER_CONSTANT,
bool tryReuseInputImage = true);
CV_EXPORTS_W int buildOpticalFlowPyramid( InputArray img, OutputArrayOfArrays pyramid,
Size winSize, int maxLevel, bool withDerivatives = true,
int pyrBorder = BORDER_REFLECT_101,
int derivBorder = BORDER_CONSTANT,
bool tryReuseInputImage = true );
/** @example samples/cpp/lkdemo.cpp
An example using the Lucas-Kanade optical flow algorithm
@@ -176,14 +175,12 @@ The function implements a sparse iterative version of the Lucas-Kanade optical f
- (Python) An example using the Lucas-Kanade tracker for homography matching can be found at
opencv_source_code/samples/python/lk_homography.py
*/
CV_EXPORTS_W void calcOpticalFlowPyrLK(InputArray prevImg, InputArray nextImg,
InputArray prevPts, InputOutputArray nextPts,
OutputArray status, OutputArray err,
Size winSize = Size(21, 21), int maxLevel = 3,
TermCriteria criteria = TermCriteria(
TermCriteria::COUNT + TermCriteria::EPS, 30,
0.01),
int flags = 0, double minEigThreshold = 1e-4);
CV_EXPORTS_W void calcOpticalFlowPyrLK( InputArray prevImg, InputArray nextImg,
InputArray prevPts, InputOutputArray nextPts,
OutputArray status, OutputArray err,
Size winSize = Size(21,21), int maxLevel = 3,
TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01),
int flags = 0, double minEigThreshold = 1e-4 );
/** @brief Computes a dense optical flow using the Gunnar Farneback's algorithm.
@@ -223,11 +220,10 @@ The function finds an optical flow for each prev pixel using the @cite Farneback
- (Python) An example using the optical flow algorithm described by Gunnar Farneback can be
found at opencv_source_code/samples/python/opt_flow.py
*/
CV_EXPORTS_W void
calcOpticalFlowFarneback(InputArray prev, InputArray next, InputOutputArray flow,
double pyr_scale, int levels, int winsize,
int iterations, int poly_n, double poly_sigma,
int flags);
CV_EXPORTS_W void calcOpticalFlowFarneback( InputArray prev, InputArray next, InputOutputArray flow,
double pyr_scale, int levels, int winsize,
int iterations, int poly_n, double poly_sigma,
int flags );
/** @brief Computes an optimal affine transformation between two 2D point sets.
@@ -259,15 +255,15 @@ with images, extract points using cv::calcOpticalFlowPyrLK and then use the esti
@sa
estimateAffine2D, estimateAffinePartial2D, getAffineTransform, getPerspectiveTransform, findHomography
*/
CV_DEPRECATED CV_EXPORTS Mat
estimateRigidTransform(InputArray src, InputArray dst, bool fullAffine);
CV_DEPRECATED CV_EXPORTS Mat estimateRigidTransform( InputArray src, InputArray dst, bool fullAffine );
enum {
MOTION_TRANSLATION = 0,
MOTION_EUCLIDEAN = 1,
MOTION_AFFINE = 2,
MOTION_HOMOGRAPHY = 3
};
enum
{
MOTION_TRANSLATION = 0,
MOTION_EUCLIDEAN = 1,
MOTION_AFFINE = 2,
MOTION_HOMOGRAPHY = 3
};
/** @brief Computes the Enhanced Correlation Coefficient value between two images @cite EP08 .
@@ -280,8 +276,7 @@ estimateAffine2D, estimateAffinePartial2D, getAffineTransform, getPerspectiveTra
findTransformECC
*/
CV_EXPORTS_W double
computeECC(InputArray templateImage, InputArray inputImage, InputArray inputMask = noArray());
CV_EXPORTS_W double computeECC(InputArray templateImage, InputArray inputImage, InputArray inputMask = noArray());
/** @example samples/cpp/image_alignment.cpp
An example using the image alignment ECC algorithm
@@ -338,18 +333,17 @@ an exception if algorithm does not converges.
@sa
computeECC, estimateAffine2D, estimateAffinePartial2D, findHomography
*/
CV_EXPORTS_W double findTransformECC(InputArray templateImage, InputArray inputImage,
InputOutputArray warpMatrix, int motionType,
TermCriteria criteria,
InputArray inputMask, int gaussFiltSize);
CV_EXPORTS_W double findTransformECC( InputArray templateImage, InputArray inputImage,
InputOutputArray warpMatrix, int motionType,
TermCriteria criteria,
InputArray inputMask, int gaussFiltSize);
/** @overload */
CV_EXPORTS
double findTransformECC(InputArray templateImage, InputArray inputImage,
InputOutputArray warpMatrix, int motionType = MOTION_AFFINE,
TermCriteria criteria = TermCriteria(
TermCriteria::COUNT + TermCriteria::EPS, 50, 0.001),
InputArray inputMask = noArray());
CV_EXPORTS
double findTransformECC(InputArray templateImage, InputArray inputImage,
InputOutputArray warpMatrix, int motionType = MOTION_AFFINE,
TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 50, 0.001),
InputArray inputMask = noArray());
/** @example samples/cpp/kalman.cpp
An example using the standard Kalman filter
@@ -363,57 +357,57 @@ an extended Kalman filter functionality.
@note In C API when CvKalman\* kalmanFilter structure is not needed anymore, it should be released
with cvReleaseKalman(&kalmanFilter)
*/
class CV_EXPORTS_W KalmanFilter {
public:
CV_WRAP KalmanFilter();
/** @overload
@param dynamParams Dimensionality of the state.
@param measureParams Dimensionality of the measurement.
@param controlParams Dimensionality of the control vector.
@param type Type of the created matrices that should be CV_32F or CV_64F.
*/
CV_WRAP KalmanFilter(int dynamParams, int measureParams, int controlParams = 0,
int type = CV_32F);
class CV_EXPORTS_W KalmanFilter
{
public:
CV_WRAP KalmanFilter();
/** @overload
@param dynamParams Dimensionality of the state.
@param measureParams Dimensionality of the measurement.
@param controlParams Dimensionality of the control vector.
@param type Type of the created matrices that should be CV_32F or CV_64F.
*/
CV_WRAP KalmanFilter( int dynamParams, int measureParams, int controlParams = 0, int type = CV_32F );
/** @brief Re-initializes Kalman filter. The previous content is destroyed.
/** @brief Re-initializes Kalman filter. The previous content is destroyed.
@param dynamParams Dimensionality of the state.
@param measureParams Dimensionality of the measurement.
@param controlParams Dimensionality of the control vector.
@param type Type of the created matrices that should be CV_32F or CV_64F.
*/
void init(int dynamParams, int measureParams, int controlParams = 0, int type = CV_32F);
@param dynamParams Dimensionality of the state.
@param measureParams Dimensionality of the measurement.
@param controlParams Dimensionality of the control vector.
@param type Type of the created matrices that should be CV_32F or CV_64F.
*/
void init( int dynamParams, int measureParams, int controlParams = 0, int type = CV_32F );
/** @brief Computes a predicted state.
/** @brief Computes a predicted state.
@param control The optional input control
*/
CV_WRAP const Mat &predict(const Mat &control = Mat());
@param control The optional input control
*/
CV_WRAP const Mat& predict( const Mat& control = Mat() );
/** @brief Updates the predicted state from the measurement.
/** @brief Updates the predicted state from the measurement.
@param measurement The measured system parameters
*/
CV_WRAP const Mat &correct(const Mat &measurement);
@param measurement The measured system parameters
*/
CV_WRAP const Mat& correct( const Mat& measurement );
CV_PROP_RW Mat statePre; //!< predicted state (x'(k)): x(k)=A*x(k-1)+B*u(k)
CV_PROP_RW Mat statePost; //!< corrected state (x(k)): x(k)=x'(k)+K(k)*(z(k)-H*x'(k))
CV_PROP_RW Mat transitionMatrix; //!< state transition matrix (A)
CV_PROP_RW Mat controlMatrix; //!< control matrix (B) (not used if there is no control)
CV_PROP_RW Mat measurementMatrix; //!< measurement matrix (H)
CV_PROP_RW Mat processNoiseCov; //!< process noise covariance matrix (Q)
CV_PROP_RW Mat measurementNoiseCov;//!< measurement noise covariance matrix (R)
CV_PROP_RW Mat errorCovPre; //!< priori error estimate covariance matrix (P'(k)): P'(k)=A*P(k-1)*At + Q)*/
CV_PROP_RW Mat gain; //!< Kalman gain matrix (K(k)): K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R)
CV_PROP_RW Mat errorCovPost; //!< posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)*H)*P'(k)
CV_PROP_RW Mat statePre; //!< predicted state (x'(k)): x(k)=A*x(k-1)+B*u(k)
CV_PROP_RW Mat statePost; //!< corrected state (x(k)): x(k)=x'(k)+K(k)*(z(k)-H*x'(k))
CV_PROP_RW Mat transitionMatrix; //!< state transition matrix (A)
CV_PROP_RW Mat controlMatrix; //!< control matrix (B) (not used if there is no control)
CV_PROP_RW Mat measurementMatrix; //!< measurement matrix (H)
CV_PROP_RW Mat processNoiseCov; //!< process noise covariance matrix (Q)
CV_PROP_RW Mat measurementNoiseCov;//!< measurement noise covariance matrix (R)
CV_PROP_RW Mat errorCovPre; //!< priori error estimate covariance matrix (P'(k)): P'(k)=A*P(k-1)*At + Q)*/
CV_PROP_RW Mat gain; //!< Kalman gain matrix (K(k)): K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R)
CV_PROP_RW Mat errorCovPost; //!< posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)*H)*P'(k)
// temporary matrices
Mat temp1;
Mat temp2;
Mat temp3;
Mat temp4;
Mat temp5;
};
// temporary matrices
Mat temp1;
Mat temp2;
Mat temp3;
Mat temp4;
Mat temp5;
};
/** @brief Read a .flo file
@@ -424,7 +418,7 @@ with cvReleaseKalman(&kalmanFilter)
Resulting Mat has a type CV_32FC2 - floating-point, 2-channel. First channel corresponds to the
flow in the horizontal direction (u), second - vertical (v).
*/
CV_EXPORTS_W Mat readOpticalFlow(const String &path);
CV_EXPORTS_W Mat readOpticalFlow( const String& path );
/** @brief Write a .flo to disk
@param path Path to the file to be written
@@ -434,92 +428,87 @@ with cvReleaseKalman(&kalmanFilter)
The flow field must be a 2-channel, floating-point matrix (CV_32FC2). First channel corresponds
to the flow in the horizontal direction (u), second - vertical (v).
*/
CV_EXPORTS_W bool writeOpticalFlow(const String &path, InputArray flow);
CV_EXPORTS_W bool writeOpticalFlow( const String& path, InputArray flow );
/**
Base class for dense optical flow algorithms
*/
class CV_EXPORTS_W DenseOpticalFlow : public Algorithm {
public:
/** @brief Calculates an optical flow.
class CV_EXPORTS_W DenseOpticalFlow : public Algorithm
{
public:
/** @brief Calculates an optical flow.
@param I0 first 8-bit single-channel input image.
@param I1 second input image of the same size and the same type as prev.
@param flow computed flow image that has the same size as prev and type CV_32FC2.
*/
CV_WRAP virtual void calc(InputArray I0, InputArray I1, InputOutputArray flow) = 0;
/** @brief Releases all inner buffers.
*/
CV_WRAP virtual void collectGarbage() = 0;
};
@param I0 first 8-bit single-channel input image.
@param I1 second input image of the same size and the same type as prev.
@param flow computed flow image that has the same size as prev and type CV_32FC2.
*/
CV_WRAP virtual void calc( InputArray I0, InputArray I1, InputOutputArray flow ) = 0;
/** @brief Releases all inner buffers.
*/
CV_WRAP virtual void collectGarbage() = 0;
};
/** @brief Base interface for sparse optical flow algorithms.
*/
class CV_EXPORTS_W SparseOpticalFlow : public Algorithm {
public:
/** @brief Calculates a sparse optical flow.
class CV_EXPORTS_W SparseOpticalFlow : public Algorithm
{
public:
/** @brief Calculates a sparse optical flow.
@param prevImg First input image.
@param nextImg Second input image of the same size and the same type as prevImg.
@param prevPts Vector of 2D points for which the flow needs to be found.
@param nextPts Output vector of 2D points containing the calculated new positions of input features in the second image.
@param status Output status vector. Each element of the vector is set to 1 if the
flow for the corresponding features has been found. Otherwise, it is set to 0.
@param err Optional output vector that contains error response for each point (inverse confidence).
*/
CV_WRAP virtual void calc(InputArray prevImg, InputArray nextImg,
InputArray prevPts, InputOutputArray nextPts,
OutputArray status,
OutputArray err = cv::noArray()) = 0;
};
@param prevImg First input image.
@param nextImg Second input image of the same size and the same type as prevImg.
@param prevPts Vector of 2D points for which the flow needs to be found.
@param nextPts Output vector of 2D points containing the calculated new positions of input features in the second image.
@param status Output status vector. Each element of the vector is set to 1 if the
flow for the corresponding features has been found. Otherwise, it is set to 0.
@param err Optional output vector that contains error response for each point (inverse confidence).
*/
CV_WRAP virtual void calc(InputArray prevImg, InputArray nextImg,
InputArray prevPts, InputOutputArray nextPts,
OutputArray status,
OutputArray err = cv::noArray()) = 0;
};
/** @brief Class computing a dense optical flow using the Gunnar Farneback's algorithm.
*/
class CV_EXPORTS_W FarnebackOpticalFlow : public DenseOpticalFlow {
public:
CV_WRAP virtual int getNumLevels() const = 0;
class CV_EXPORTS_W FarnebackOpticalFlow : public DenseOpticalFlow
{
public:
CV_WRAP virtual int getNumLevels() const = 0;
CV_WRAP virtual void setNumLevels(int numLevels) = 0;
CV_WRAP virtual void setNumLevels(int numLevels) = 0;
CV_WRAP virtual double getPyrScale() const = 0;
CV_WRAP virtual void setPyrScale(double pyrScale) = 0;
CV_WRAP virtual double getPyrScale() const = 0;
CV_WRAP virtual bool getFastPyramids() const = 0;
CV_WRAP virtual void setFastPyramids(bool fastPyramids) = 0;
CV_WRAP virtual void setPyrScale(double pyrScale) = 0;
CV_WRAP virtual int getWinSize() const = 0;
CV_WRAP virtual void setWinSize(int winSize) = 0;
CV_WRAP virtual bool getFastPyramids() const = 0;
CV_WRAP virtual int getNumIters() const = 0;
CV_WRAP virtual void setNumIters(int numIters) = 0;
CV_WRAP virtual void setFastPyramids(bool fastPyramids) = 0;
CV_WRAP virtual int getPolyN() const = 0;
CV_WRAP virtual void setPolyN(int polyN) = 0;
CV_WRAP virtual int getWinSize() const = 0;
CV_WRAP virtual double getPolySigma() const = 0;
CV_WRAP virtual void setPolySigma(double polySigma) = 0;
CV_WRAP virtual void setWinSize(int winSize) = 0;
CV_WRAP virtual int getFlags() const = 0;
CV_WRAP virtual void setFlags(int flags) = 0;
CV_WRAP virtual int getNumIters() const = 0;
CV_WRAP virtual void setNumIters(int numIters) = 0;
CV_WRAP virtual int getPolyN() const = 0;
CV_WRAP virtual void setPolyN(int polyN) = 0;
CV_WRAP virtual double getPolySigma() const = 0;
CV_WRAP virtual void setPolySigma(double polySigma) = 0;
CV_WRAP virtual int getFlags() const = 0;
CV_WRAP virtual void setFlags(int flags) = 0;
CV_WRAP static Ptr <FarnebackOpticalFlow> create(
int numLevels = 5,
double pyrScale = 0.5,
bool fastPyramids = false,
int winSize = 13,
int numIters = 10,
int polyN = 5,
double polySigma = 1.1,
int flags = 0);
};
CV_WRAP static Ptr<FarnebackOpticalFlow> create(
int numLevels = 5,
double pyrScale = 0.5,
bool fastPyramids = false,
int winSize = 13,
int numIters = 10,
int polyN = 5,
double polySigma = 1.1,
int flags = 0);
};
/** @brief Variational optical flow refinement
@@ -531,54 +520,54 @@ respectively. \f$\Psi(s^2)=\sqrt{s^2+\epsilon^2}\f$ is a robust penalizer to lim
influence of outliers. A complete formulation and a description of the minimization
procedure can be found in @cite Brox2004
*/
class CV_EXPORTS_W VariationalRefinement : public DenseOpticalFlow {
public:
/** @brief @ref calc function overload to handle separate horizontal (u) and vertical (v) flow components
(to avoid extra splits/merges) */
CV_WRAP virtual void
calcUV(InputArray I0, InputArray I1, InputOutputArray flow_u, InputOutputArray flow_v) = 0;
class CV_EXPORTS_W VariationalRefinement : public DenseOpticalFlow
{
public:
/** @brief @ref calc function overload to handle separate horizontal (u) and vertical (v) flow components
(to avoid extra splits/merges) */
CV_WRAP virtual void calcUV(InputArray I0, InputArray I1, InputOutputArray flow_u, InputOutputArray flow_v) = 0;
/** @brief Number of outer (fixed-point) iterations in the minimization procedure.
@see setFixedPointIterations */
CV_WRAP virtual int getFixedPointIterations() const = 0;
/** @copybrief getFixedPointIterations @see getFixedPointIterations */
CV_WRAP virtual void setFixedPointIterations(int val) = 0;
/** @brief Number of outer (fixed-point) iterations in the minimization procedure.
@see setFixedPointIterations */
CV_WRAP virtual int getFixedPointIterations() const = 0;
/** @copybrief getFixedPointIterations @see getFixedPointIterations */
CV_WRAP virtual void setFixedPointIterations(int val) = 0;
/** @brief Number of inner successive over-relaxation (SOR) iterations
in the minimization procedure to solve the respective linear system.
@see setSorIterations */
CV_WRAP virtual int getSorIterations() const = 0;
/** @copybrief getSorIterations @see getSorIterations */
CV_WRAP virtual void setSorIterations(int val) = 0;
/** @brief Number of inner successive over-relaxation (SOR) iterations
in the minimization procedure to solve the respective linear system.
@see setSorIterations */
CV_WRAP virtual int getSorIterations() const = 0;
/** @copybrief getSorIterations @see getSorIterations */
CV_WRAP virtual void setSorIterations(int val) = 0;
/** @brief Relaxation factor in SOR
@see setOmega */
CV_WRAP virtual float getOmega() const = 0;
/** @copybrief getOmega @see getOmega */
CV_WRAP virtual void setOmega(float val) = 0;
/** @brief Relaxation factor in SOR
@see setOmega */
CV_WRAP virtual float getOmega() const = 0;
/** @copybrief getOmega @see getOmega */
CV_WRAP virtual void setOmega(float val) = 0;
/** @brief Weight of the smoothness term
@see setAlpha */
CV_WRAP virtual float getAlpha() const = 0;
/** @copybrief getAlpha @see getAlpha */
CV_WRAP virtual void setAlpha(float val) = 0;
/** @brief Weight of the smoothness term
@see setAlpha */
CV_WRAP virtual float getAlpha() const = 0;
/** @copybrief getAlpha @see getAlpha */
CV_WRAP virtual void setAlpha(float val) = 0;
/** @brief Weight of the color constancy term
@see setDelta */
CV_WRAP virtual float getDelta() const = 0;
/** @copybrief getDelta @see getDelta */
CV_WRAP virtual void setDelta(float val) = 0;
/** @brief Weight of the color constancy term
@see setDelta */
CV_WRAP virtual float getDelta() const = 0;
/** @copybrief getDelta @see getDelta */
CV_WRAP virtual void setDelta(float val) = 0;
/** @brief Weight of the gradient constancy term
@see setGamma */
CV_WRAP virtual float getGamma() const = 0;
/** @copybrief getGamma @see getGamma */
CV_WRAP virtual void setGamma(float val) = 0;
/** @brief Weight of the gradient constancy term
@see setGamma */
CV_WRAP virtual float getGamma() const = 0;
/** @copybrief getGamma @see getGamma */
CV_WRAP virtual void setGamma(float val) = 0;
/** @brief Creates an instance of VariationalRefinement
*/
CV_WRAP static Ptr <VariationalRefinement> create();
};
/** @brief Creates an instance of VariationalRefinement
*/
CV_WRAP static Ptr<VariationalRefinement> create();
};
/** @brief DIS optical flow algorithm.
@@ -592,94 +581,96 @@ including spatial propagation of flow vectors (@ref getUseSpatialPropagation), a
utilize an initial flow approximation passed to @ref calc (which is, essentially, temporal propagation,
if the previous frame's flow field is passed).
*/
class CV_EXPORTS_W DISOpticalFlow : public DenseOpticalFlow {
public:
enum {
PRESET_ULTRAFAST = 0,
PRESET_FAST = 1,
PRESET_MEDIUM = 2
};
/** @brief Finest level of the Gaussian pyramid on which the flow is computed (zero level
corresponds to the original image resolution). The final flow is obtained by bilinear upscaling.
@see setFinestScale */
CV_WRAP virtual int getFinestScale() const = 0;
/** @copybrief getFinestScale @see getFinestScale */
CV_WRAP virtual void setFinestScale(int val) = 0;
/** @brief Size of an image patch for matching (in pixels). Normally, default 8x8 patches work well
enough in most cases.
@see setPatchSize */
CV_WRAP virtual int getPatchSize() const = 0;
/** @copybrief getPatchSize @see getPatchSize */
CV_WRAP virtual void setPatchSize(int val) = 0;
/** @brief Stride between neighbor patches. Must be less than patch size. Lower values correspond
to higher flow quality.
@see setPatchStride */
CV_WRAP virtual int getPatchStride() const = 0;
/** @copybrief getPatchStride @see getPatchStride */
CV_WRAP virtual void setPatchStride(int val) = 0;
/** @brief Maximum number of gradient descent iterations in the patch inverse search stage. Higher values
may improve quality in some cases.
@see setGradientDescentIterations */
CV_WRAP virtual int getGradientDescentIterations() const = 0;
/** @copybrief getGradientDescentIterations @see getGradientDescentIterations */
CV_WRAP virtual void setGradientDescentIterations(int val) = 0;
/** @brief Number of fixed point iterations of variational refinement per scale. Set to zero to
disable variational refinement completely. Higher values will typically result in more smooth and
high-quality flow.
@see setGradientDescentIterations */
CV_WRAP virtual int getVariationalRefinementIterations() const = 0;
/** @copybrief getGradientDescentIterations @see getGradientDescentIterations */
CV_WRAP virtual void setVariationalRefinementIterations(int val) = 0;
/** @brief Weight of the smoothness term
@see setVariationalRefinementAlpha */
CV_WRAP virtual float getVariationalRefinementAlpha() const = 0;
/** @copybrief getVariationalRefinementAlpha @see getVariationalRefinementAlpha */
CV_WRAP virtual void setVariationalRefinementAlpha(float val) = 0;
/** @brief Weight of the color constancy term
@see setVariationalRefinementDelta */
CV_WRAP virtual float getVariationalRefinementDelta() const = 0;
/** @copybrief getVariationalRefinementDelta @see getVariationalRefinementDelta */
CV_WRAP virtual void setVariationalRefinementDelta(float val) = 0;
/** @brief Weight of the gradient constancy term
@see setVariationalRefinementGamma */
CV_WRAP virtual float getVariationalRefinementGamma() const = 0;
/** @copybrief getVariationalRefinementGamma @see getVariationalRefinementGamma */
CV_WRAP virtual void setVariationalRefinementGamma(float val) = 0;
/** @brief Whether to use mean-normalization of patches when computing patch distance. It is turned on
by default as it typically provides a noticeable quality boost because of increased robustness to
illumination variations. Turn it off if you are certain that your sequence doesn't contain any changes
in illumination.
@see setUseMeanNormalization */
CV_WRAP virtual bool getUseMeanNormalization() const = 0;
/** @copybrief getUseMeanNormalization @see getUseMeanNormalization */
CV_WRAP virtual void setUseMeanNormalization(bool val) = 0;
/** @brief Whether to use spatial propagation of good optical flow vectors. This option is turned on by
default, as it tends to work better on average and can sometimes help recover from major errors
introduced by the coarse-to-fine scheme employed by the DIS optical flow algorithm. Turning this
option off can make the output flow field a bit smoother, however.
@see setUseSpatialPropagation */
CV_WRAP virtual bool getUseSpatialPropagation() const = 0;
/** @copybrief getUseSpatialPropagation @see getUseSpatialPropagation */
CV_WRAP virtual void setUseSpatialPropagation(bool val) = 0;
/** @brief Creates an instance of DISOpticalFlow
@param preset one of PRESET_ULTRAFAST, PRESET_FAST and PRESET_MEDIUM
*/
CV_WRAP static Ptr <DISOpticalFlow> create(int preset = DISOpticalFlow::PRESET_FAST);
class CV_EXPORTS_W DISOpticalFlow : public DenseOpticalFlow
{
public:
enum
{
PRESET_ULTRAFAST = 0,
PRESET_FAST = 1,
PRESET_MEDIUM = 2
};
/** @brief Finest level of the Gaussian pyramid on which the flow is computed (zero level
corresponds to the original image resolution). The final flow is obtained by bilinear upscaling.
@see setFinestScale */
CV_WRAP virtual int getFinestScale() const = 0;
/** @copybrief getFinestScale @see getFinestScale */
CV_WRAP virtual void setFinestScale(int val) = 0;
/** @brief Size of an image patch for matching (in pixels). Normally, default 8x8 patches work well
enough in most cases.
@see setPatchSize */
CV_WRAP virtual int getPatchSize() const = 0;
/** @copybrief getPatchSize @see getPatchSize */
CV_WRAP virtual void setPatchSize(int val) = 0;
/** @brief Stride between neighbor patches. Must be less than patch size. Lower values correspond
to higher flow quality.
@see setPatchStride */
CV_WRAP virtual int getPatchStride() const = 0;
/** @copybrief getPatchStride @see getPatchStride */
CV_WRAP virtual void setPatchStride(int val) = 0;
/** @brief Maximum number of gradient descent iterations in the patch inverse search stage. Higher values
may improve quality in some cases.
@see setGradientDescentIterations */
CV_WRAP virtual int getGradientDescentIterations() const = 0;
/** @copybrief getGradientDescentIterations @see getGradientDescentIterations */
CV_WRAP virtual void setGradientDescentIterations(int val) = 0;
/** @brief Number of fixed point iterations of variational refinement per scale. Set to zero to
disable variational refinement completely. Higher values will typically result in more smooth and
high-quality flow.
@see setGradientDescentIterations */
CV_WRAP virtual int getVariationalRefinementIterations() const = 0;
/** @copybrief getGradientDescentIterations @see getGradientDescentIterations */
CV_WRAP virtual void setVariationalRefinementIterations(int val) = 0;
/** @brief Weight of the smoothness term
@see setVariationalRefinementAlpha */
CV_WRAP virtual float getVariationalRefinementAlpha() const = 0;
/** @copybrief getVariationalRefinementAlpha @see getVariationalRefinementAlpha */
CV_WRAP virtual void setVariationalRefinementAlpha(float val) = 0;
/** @brief Weight of the color constancy term
@see setVariationalRefinementDelta */
CV_WRAP virtual float getVariationalRefinementDelta() const = 0;
/** @copybrief getVariationalRefinementDelta @see getVariationalRefinementDelta */
CV_WRAP virtual void setVariationalRefinementDelta(float val) = 0;
/** @brief Weight of the gradient constancy term
@see setVariationalRefinementGamma */
CV_WRAP virtual float getVariationalRefinementGamma() const = 0;
/** @copybrief getVariationalRefinementGamma @see getVariationalRefinementGamma */
CV_WRAP virtual void setVariationalRefinementGamma(float val) = 0;
/** @brief Whether to use mean-normalization of patches when computing patch distance. It is turned on
by default as it typically provides a noticeable quality boost because of increased robustness to
illumination variations. Turn it off if you are certain that your sequence doesn't contain any changes
in illumination.
@see setUseMeanNormalization */
CV_WRAP virtual bool getUseMeanNormalization() const = 0;
/** @copybrief getUseMeanNormalization @see getUseMeanNormalization */
CV_WRAP virtual void setUseMeanNormalization(bool val) = 0;
/** @brief Whether to use spatial propagation of good optical flow vectors. This option is turned on by
default, as it tends to work better on average and can sometimes help recover from major errors
introduced by the coarse-to-fine scheme employed by the DIS optical flow algorithm. Turning this
option off can make the output flow field a bit smoother, however.
@see setUseSpatialPropagation */
CV_WRAP virtual bool getUseSpatialPropagation() const = 0;
/** @copybrief getUseSpatialPropagation @see getUseSpatialPropagation */
CV_WRAP virtual void setUseSpatialPropagation(bool val) = 0;
/** @brief Creates an instance of DISOpticalFlow
@param preset one of PRESET_ULTRAFAST, PRESET_FAST and PRESET_MEDIUM
*/
CV_WRAP static Ptr<DISOpticalFlow> create(int preset = DISOpticalFlow::PRESET_FAST);
};
/** @brief Class used for calculating a sparse optical flow.
The class can calculate an optical flow for a sparse feature set using the
@@ -688,35 +679,31 @@ iterative Lucas-Kanade method with pyramids.
@sa calcOpticalFlowPyrLK
*/
class CV_EXPORTS_W SparsePyrLKOpticalFlow : public SparseOpticalFlow {
public:
CV_WRAP virtual Size getWinSize() const = 0;
class CV_EXPORTS_W SparsePyrLKOpticalFlow : public SparseOpticalFlow
{
public:
CV_WRAP virtual Size getWinSize() const = 0;
CV_WRAP virtual void setWinSize(Size winSize) = 0;
CV_WRAP virtual void setWinSize(Size winSize) = 0;
CV_WRAP virtual int getMaxLevel() const = 0;
CV_WRAP virtual void setMaxLevel(int maxLevel) = 0;
CV_WRAP virtual int getMaxLevel() const = 0;
CV_WRAP virtual TermCriteria getTermCriteria() const = 0;
CV_WRAP virtual void setTermCriteria(TermCriteria& crit) = 0;
CV_WRAP virtual void setMaxLevel(int maxLevel) = 0;
CV_WRAP virtual int getFlags() const = 0;
CV_WRAP virtual void setFlags(int flags) = 0;
CV_WRAP virtual TermCriteria getTermCriteria() const = 0;
CV_WRAP virtual double getMinEigThreshold() const = 0;
CV_WRAP virtual void setMinEigThreshold(double minEigThreshold) = 0;
CV_WRAP virtual void setTermCriteria(TermCriteria &crit) = 0;
CV_WRAP virtual int getFlags() const = 0;
CV_WRAP virtual void setFlags(int flags) = 0;
CV_WRAP virtual double getMinEigThreshold() const = 0;
CV_WRAP virtual void setMinEigThreshold(double minEigThreshold) = 0;
CV_WRAP static Ptr <SparsePyrLKOpticalFlow> create(
Size winSize = Size(21, 21),
int maxLevel = 3, TermCriteria crit =
TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, 0.01),
int flags = 0,
double minEigThreshold = 1e-4);
};
CV_WRAP static Ptr<SparsePyrLKOpticalFlow> create(
Size winSize = Size(21, 21),
int maxLevel = 3, TermCriteria crit =
TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01),
int flags = 0,
double minEigThreshold = 1e-4);
};
//! @} video_track