doxygenated opencv_video & opencv_calib3d modules (C++ part only)

This commit is contained in:
Vadim Pisarevsky
2010-05-25 15:59:48 +00:00
parent eff42cdabd
commit 266c4642ea
6 changed files with 148 additions and 33 deletions

View File

@@ -353,22 +353,45 @@ CVAPI(CvSeq*) cvSegmentFGMask( CvArr *fgmask, int poly1Hull0 CV_DEFAULT(1),
namespace cv
{
/*!
The Base Class for Background/Foreground Segmentation
The class is only used to define the common interface for
the whole family of background/foreground segmentation algorithms.
*/
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 Mat& image, Mat& fgmask, double learningRate=0);
};
/*!
Gaussian Mixture-based Backbround/Foreground Segmentation Algorithm
The class implements the following algorithm:
"An improved adaptive background mixture model for real-time tracking with shadow detection"
P. KadewTraKuPong and R. Bowden,
Proc. 2nd European Workshp on Advanced Video-Based Surveillance Systems, 2001."
http://personal.ee.surrey.ac.uk/Personal/R.Bowden/publications/avbs01/avbs01.pdf
*/
class CV_EXPORTS BackgroundSubtractorMOG : public BackgroundSubtractor
{
public:
//! the default constructor
BackgroundSubtractorMOG();
//! the full constructor that takes the length of the history, the number of gaussian mixtures, the background ratio parameter and the noise strength
BackgroundSubtractorMOG(int history, int nmixtures, double backgroundRatio, double noiseSigma=0);
//! the destructor
virtual ~BackgroundSubtractorMOG();
//! the update operator
virtual void operator()(const Mat& image, Mat& fgmask, double learningRate=0);
//! re-initiaization method
virtual void initialize(Size frameSize, int frameType);
Size frameSize;

View File

@@ -1,3 +1,7 @@
/*! \file tracking.hpp
\brief The Object and Feature Tracking
*/
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
@@ -230,58 +234,74 @@ CVAPI(const CvMat*) cvKalmanPredict( CvKalman* kalman,
(corrects state of the system and internal matrices) */
CVAPI(const CvMat*) cvKalmanCorrect( CvKalman* kalman, const CvMat* measurement );
#define cvKalmanUpdateByTime cvKalmanPredict
#define cvKalmanUpdateByMeasurement cvKalmanCorrect
#ifdef __cplusplus
}
namespace cv
{
//! updates motion history image using the current silhouette
CV_EXPORTS void updateMotionHistory( const Mat& silhouette, Mat& mhi,
double timestamp, double duration );
//! computes the motion gradient orientation image from the motion history image
CV_EXPORTS void calcMotionGradient( const Mat& mhi, Mat& mask,
Mat& orientation,
double delta1, double delta2,
int apertureSize=3 );
//! computes the global orientation of the selected motion history image part
CV_EXPORTS double calcGlobalOrientation( const Mat& orientation, const Mat& mask,
const Mat& mhi, double timestamp,
double duration );
// TODO: need good API for cvSegmentMotion
//! updates the object tracking window using CAMSHIFT algorithm
CV_EXPORTS RotatedRect CamShift( const Mat& probImage, Rect& window,
TermCriteria criteria );
//! updates the object tracking window using meanshift algorithm
CV_EXPORTS int meanShift( const Mat& probImage, Rect& window,
TermCriteria criteria );
/*!
Kalman filter.
The class implements standard Kalman filter \url{http://en.wikipedia.org/wiki/Kalman_filter}.
However, you can modify KalmanFilter::transitionMatrix, KalmanFilter::controlMatrix and
KalmanFilter::measurementMatrix to get the extended Kalman filter functionality.
*/
class CV_EXPORTS KalmanFilter
{
public:
//! the default constructor
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);
//! re-initializes Kalman filter. The previous content is destroyed.
void init(int dynamParams, int measureParams, int controlParams=0);
//! computes predicted state
const Mat& predict(const Mat& control=Mat());
//! updates the predicted state from the measurement
const Mat& correct(const Mat& measurement);
Mat statePre; // predicted state (x'(k)):
// x(k)=A*x(k-1)+B*u(k)
Mat statePost; // corrected state (x(k)):
// x(k)=x'(k)+K(k)*(z(k)-H*x'(k))
Mat transitionMatrix; // state transition matrix (A)
Mat controlMatrix; // control matrix (B)
// (it is not used if there is no control)
Mat measurementMatrix; // measurement matrix (H)
Mat processNoiseCov; // process noise covariance matrix (Q)
Mat measurementNoiseCov;// measurement noise covariance matrix (R)
Mat errorCovPre; // priori error estimate covariance matrix (P'(k)):
// P'(k)=A*P(k-1)*At + Q)*/
Mat gain; // Kalman gain matrix (K(k)):
// K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R)
Mat errorCovPost; // posteriori error estimate covariance matrix (P(k)):
// P(k)=(I-K(k)*H)*P'(k)
Mat temp1; // temporary matrices
Mat statePre; //!< predicted state (x'(k)): x(k)=A*x(k-1)+B*u(k)
Mat statePost; //!< corrected state (x(k)): x(k)=x'(k)+K(k)*(z(k)-H*x'(k))
Mat transitionMatrix; //!< state transition matrix (A)
Mat controlMatrix; //!< control matrix (B) (not used if there is no control)
Mat measurementMatrix; //!< measurement matrix (H)
Mat processNoiseCov; //!< process noise covariance matrix (Q)
Mat measurementNoiseCov;//!< measurement noise covariance matrix (R)
Mat errorCovPre; //!< priori error estimate covariance matrix (P'(k)): P'(k)=A*P(k-1)*At + Q)*/
Mat gain; //!< Kalman gain matrix (K(k)): K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R)
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;
@@ -289,12 +309,9 @@ public:
};
#define cvKalmanUpdateByTime cvKalmanPredict
#define cvKalmanUpdateByMeasurement cvKalmanCorrect
enum { OPTFLOW_USE_INITIAL_FLOW=4, OPTFLOW_FARNEBACK_GAUSSIAN=256 };
//! computes sparse optical flow using multi-scale Lucas-Kanade algorithm
CV_EXPORTS void calcOpticalFlowPyrLK( const Mat& prevImg, const Mat& nextImg,
const vector<Point2f>& prevPts, vector<Point2f>& nextPts,
vector<uchar>& status, vector<float>& err,
@@ -305,6 +322,7 @@ CV_EXPORTS void calcOpticalFlowPyrLK( const Mat& prevImg, const Mat& nextImg,
double derivLambda=0.5,
int flags=0 );
//! computes dense optical flow using Farneback algorithm
CV_EXPORTS void calcOpticalFlowFarneback( const Mat& prev0, const Mat& next0,
Mat& flow0, double pyr_scale, int levels, int winsize,
int iterations, int poly_n, double poly_sigma, int flags );