Class used for strong corners detection on an image.
class GoodFeaturesToTrackDetector_OCL
{
public:
explicit GoodFeaturesToTrackDetector_OCL(int maxCorners = 1000, double qualityLevel = 0.01, double minDistance = 0.0,
int blockSize = 3, bool useHarrisDetector = false, double harrisK = 0.04);
//! return 1 rows matrix with CV_32FC2 type
void operator ()(const oclMat& image, oclMat& corners, const oclMat& mask = oclMat());
//! download points of type Point2f to a vector. the vector's content will be erased
void downloadPoints(const oclMat &points, std::vector<Point2f> &points_v);
int maxCorners;
double qualityLevel;
double minDistance;
int blockSize;
bool useHarrisDetector;
double harrisK;
void releaseMemory()
{
Dx_.release();
Dy_.release();
eig_.release();
minMaxbuf_.release();
tmpCorners_.release();
}
};
The class finds the most prominent corners in the image.
See also
Constructor.
Parameters: |
|
---|
Finds the most prominent corners in the image.
Parameters: |
|
---|
See also
Releases inner buffers memory.
Class computing a dense optical flow using the Gunnar Farneback’s algorithm.
class CV_EXPORTS FarnebackOpticalFlow
{
public:
FarnebackOpticalFlow();
int numLevels;
double pyrScale;
bool fastPyramids;
int winSize;
int numIters;
int polyN;
double polySigma;
int flags;
void operator ()(const oclMat &frame0, const oclMat &frame1, oclMat &flowx, oclMat &flowy);
void releaseMemory();
private:
/* hidden */
};
Computes a dense optical flow using the Gunnar Farneback’s algorithm.
Parameters: |
|
---|
See also
Releases unused auxiliary memory buffers.
Class used for calculating an optical flow.
class PyrLKOpticalFlow
{
public:
PyrLKOpticalFlow();
void sparse(const oclMat& prevImg, const oclMat& nextImg, const oclMat& prevPts, oclMat& nextPts,
oclMat& status, oclMat* err = 0);
void dense(const oclMat& prevImg, const oclMat& nextImg, oclMat& u, oclMat& v, oclMat* err = 0);
Size winSize;
int maxLevel;
int iters;
double derivLambda;
bool useInitialFlow;
float minEigThreshold;
bool getMinEigenVals;
void releaseMemory();
private:
/* hidden */
};
The class can calculate an optical flow for a sparse feature set or dense optical flow using the iterative Lucas-Kanade method with pyramids.
See also
Calculate an optical flow for a sparse feature set.
Parameters: |
|
---|
See also
Calculate dense optical flow.
Parameters: |
|
---|
Releases inner buffers memory.
Interpolates frames (images) using provided optical flow (displacement field).
Parameters: |
|
---|
Kalman filter class.
class CV_EXPORTS KalmanFilter
{
public:
KalmanFilter();
//! the full constructor taking the dimensionality of the state, of the measurement and of the control vector
KalmanFilter(int dynamParams, int measureParams, int controlParams=0, int type=CV_32F);
//! re-initializes Kalman filter. The previous content is destroyed.
void init(int dynamParams, int measureParams, int controlParams=0, int type=CV_32F);
const oclMat& predict(const oclMat& control=oclMat());
const oclMat& correct(const oclMat& measurement);
oclMat statePre; //!< predicted state (x'(k)): x(k)=A*x(k-1)+B*u(k)
oclMat statePost; //!< corrected state (x(k)): x(k)=x'(k)+K(k)*(z(k)-H*x'(k))
oclMat transitionMatrix; //!< state transition matrix (A)
oclMat controlMatrix; //!< control matrix (B) (not used if there is no control)
oclMat measurementMatrix; //!< measurement matrix (H)
oclMat processNoiseCov; //!< process noise covariance matrix (Q)
oclMat measurementNoiseCov;//!< measurement noise covariance matrix (R)
oclMat errorCovPre; //!< priori error estimate covariance matrix (P'(k)): P'(k)=A*P(k-1)*At + Q)*/
oclMat gain; //!< Kalman gain matrix (K(k)): K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R)
oclMat errorCovPost; //!< posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)*H)*P'(k)
private:
/* hidden */
};
The constructors.
The full constructor.
Parameters: |
|
---|
Re-initializes Kalman filter. The previous content is destroyed.
Parameters: |
|
---|
Computes a predicted state.
Parameters: |
|
---|
Updates the predicted state from the measurement.
Parameters: |
|
---|
Base class for background/foreground segmentation.
class CV_EXPORTS BackgroundSubtractor
{
public:
//! the virtual destructor
virtual ~BackgroundSubtractor();
//! the update operator that takes the next video frame and returns the current foreground mask as 8-bit binary image.
virtual void operator()(const oclMat& image, oclMat& fgmask, float learningRate);
//! computes a background image
virtual void getBackgroundImage(oclMat& backgroundImage) const = 0;
};
The class is only used to define the common interface for the whole family of background/foreground segmentation algorithms.
Computes a foreground mask.
Parameters: |
|
---|
Computes a background image.
Parameters: |
|
---|
Note
Sometimes the background image can be very blurry, as it contain the average background statistics.
Gaussian Mixture-based Backbround/Foreground Segmentation Algorithm.
class CV_EXPORTS MOG: public cv::ocl::BackgroundSubtractor
{
public:
//! the default constructor
MOG(int nmixtures = -1);
//! re-initiaization method
void initialize(Size frameSize, int frameType);
//! the update operator
void operator()(const oclMat& frame, oclMat& fgmask, float learningRate = 0.f);
//! computes a background image which are the mean of all background gaussians
void getBackgroundImage(oclMat& backgroundImage) const;
//! releases all inner buffers
void release();
int history;
float varThreshold;
float backgroundRatio;
float noiseSigma;
private:
/* hidden */
};
The class discriminates between foreground and background pixels by building and maintaining a model of the background. Any pixel which does not fit this model is then deemed to be foreground. The class implements algorithm described in [MOG2001].
See also
The constructor.
Parameters: |
|
---|
Default constructor sets all parameters to default values.
Updates the background model and returns the foreground mask.
Parameters: |
|
---|
Computes a background image.
Parameters: |
|
---|
Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
The class discriminates between foreground and background pixels by building and maintaining a model of the background. Any pixel which does not fit this model is then deemed to be foreground. The class implements algorithm described in [MOG2004].
class CV_EXPORTS MOG2: public cv::ocl::BackgroundSubtractor
{
public:
//! the default constructor
MOG2(int nmixtures = -1);
//! re-initiaization method
void initialize(Size frameSize, int frameType);
//! the update operator
void operator()(const oclMat& frame, oclMat& fgmask, float learningRate = -1.0f);
//! computes a background image which are the mean of all background gaussians
void getBackgroundImage(oclMat& backgroundImage) const;
//! releases all inner buffers
void release();
int history;
float varThreshold;
float backgroundRatio;
float varThresholdGen;
float fVarInit;
float fVarMin;
float fVarMax;
float fCT;
bool bShadowDetection;
unsigned char nShadowDetection;
float fTau;
private:
/* hidden */
};
Threshold defining whether the component is significant enough to be included into the background model. cf=0.1 => TB=0.9 is default. For alpha=0.001, it means that the mode should exist for approximately 105 frames before it is considered foreground.
Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the existing components (corresponds to Tg). If it is not close to any component, a new component is generated. 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.
Initial variance for the newly generated components. It affects the speed of adaptation. The parameter value is based on your estimate of the typical standard deviation from the images. OpenCV uses 15 as a reasonable value.
Parameter used to further control the variance.
Parameter used to further control the variance.
Complexity reduction parameter. 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.
The value for marking shadow pixels in the output foreground mask. Default value is 127.
Shadow threshold. The shadow is detected if the pixel is a darker version of the background. Tau 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 [ShadowDetect2003].
Parameter defining whether shadow detection should be enabled.
See also
The constructor.
Parameters: |
|
---|
Default constructor sets all parameters to default values.
Updates the background model and returns the foreground mask.
Parameters: |
|
---|