Calculates an optical flow for a sparse feature set using the iterative LucasKanade method with pyramids.
Parameters: 


The function implements a sparse iterative version of the LucasKanade optical flow in pyramids. See [Bouguet00].
Computes a dense optical flow using the Gunnar Farneback’s algorithm.
Parameters: 


The function finds an optical flow for each prevImg pixel using the [Farneback2003] alorithm so that
Calculates the optical flow for two images by using the block matching method.
Parameters: 


The function calculates the optical flow for overlapped blocks blockSize.width x blockSize.height pixels each, thus the velocity fields are smaller than the original images. For every block in prev the functions tries to find a similar block in curr in some neighborhood of the original block or shifted by (velx(x0,y0), vely(x0,y0)) block as has been calculated by previous function call (if usePrevious=1)
Calculates the optical flow for two images using HornSchunck algorithm.
Parameters: 


The function computes the flow for every pixel of the first input image using the Horn and Schunck algorithm [Horn81]. The function is obsolete. To track sparse features, use calcOpticalFlowPyrLK(). To track all the pixels, use calcOpticalFlowFarneback().
Calculates the optical flow for two images using LucasKanade algorithm.
Parameters: 


The function computes the flow for every pixel of the first input image using the Lucas and Kanade algorithm [Lucas81]. The function is obsolete. To track sparse features, use calcOpticalFlowPyrLK(). To track all the pixels, use calcOpticalFlowFarneback().
Computes an optimal affine transformation between two 2D point sets.
Parameters: 


The function finds an optimal affine transform [Ab] (a 2 x 3 floatingpoint matrix) that approximates best the affine transformation between:
 Two point sets
 Two raster images. In this case, the function first finds some features in the src image and finds the corresponding features in dst image. After that, the problem is reduced to the first case.
In case of point sets, the problem is formulated as follows: you need to find a 2x2 matrix A and 2x1 vector b so that:
where src[i] and dst[i] are the ith points in src and dst, respectively
can be either arbitrary (when fullAffine=true ) or have a form of
when fullAffine=false .
Updates the motion history image by a moving silhouette.
Parameters: 


The function updates the motion history image as follows:
That is, MHI pixels where the motion occurs are set to the current timestamp , while the pixels where the motion happened last time a long time ago are cleared.
The function, together with calcMotionGradient() and calcGlobalOrientation() , implements a motion templates technique described in [Davis97] and [Bradski00]. See also the OpenCV sample motempl.c that demonstrates the use of all the motion template functions.
Calculates a gradient orientation of a motion history image.
Parameters: 


The function calculates a gradient orientation at each pixel as:
In fact, fastAtan2() and phase() are used so that the computed angle is measured in degrees and covers the full range 0..360. Also, the mask is filled to indicate pixels where the computed angle is valid.
Calculates a global motion orientation in a selected region.
Parameters: 


The function calculates an average motion direction in the selected region and returns the angle between 0 degrees and 360 degrees. The average direction is computed from the weighted orientation histogram, where a recent motion has a larger weight and the motion occurred in the past has a smaller weight, as recorded in mhi .
Splits a motion history image into a few parts corresponding to separate independent motions (for example, left hand, right hand).
Parameters: 


The function finds all of the motion segments and marks them in segmask with individual values (1,2,...). It also computes a vector with ROIs of motion connected components. After that the motion direction for every component can be calculated with calcGlobalOrientation() using the extracted mask of the particular component.
Finds an object center, size, and orientation.
Parameters: 


The function implements the CAMSHIFT object tracking algrorithm [Bradski98]. First, it finds an object center using meanShift() and then adjusts the window size and finds the optimal rotation. The function returns the rotated rectangle structure that includes the object position, size, and orientation. The next position of the search window can be obtained with RotatedRect::boundingRect() .
See the OpenCV sample camshiftdemo.c that tracks colored objects.
Finds an object on a back projection image.
Parameters: 


The function implements the iterative object search algorithm. It takes the input back projection of an object and the initial position. The mass center in window of the back projection image is computed and the search window center shifts to the mass center. The procedure is repeated until the specified number of iterations criteria.maxCount is done or until the window center shifts by less than criteria.epsilon . The algorithm is used inside CamShift() and, unlike CamShift() , the search window size or orientation do not change during the search. You can simply pass the output of calcBackProject() to this function. But better results can be obtained if you prefilter the back projection and remove the noise. For example, you can do this by retrieving connected components with findContours() , throwing away contours with small area ( contourArea() ), and rendering the remaining contours with drawContours() .
Kalman filter class.
The class implements a standard Kalman filter http://en.wikipedia.org/wiki/Kalman_filter, [Welch95]. However, you can modify transitionMatrix, controlMatrix, and measurementMatrix to get an extended Kalman filter functionality. See the OpenCV sample kalman.cpp .
The constructors.
The full constructor.
Parameters: 


Note
In C API when CvKalman* kalmanFilter structure is not needed anymore, it should be released with cvReleaseKalman(&kalmanFilter)
Reinitializes Kalman filter. The previous content is destroyed.
Parameters: 


Computes a predicted state.
Parameters:  control – The optional input control 

Updates the predicted state from the measurement.
Parameters:  control – The measured system parameters 

Base class for background/foreground segmentation.
class BackgroundSubtractor
{
public:
virtual ~BackgroundSubtractor();
virtual void operator()(InputArray image, OutputArray fgmask, double learningRate=0);
virtual void getBackgroundImage(OutputArray backgroundImage) const;
};
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 Mixturebased Backbround/Foreground Segmentation Algorithm.
The class implements the algorithm described in P. KadewTraKuPong and R. Bowden, An improved adaptive background mixture model for realtime tracking with shadow detection, Proc. 2nd European Workshp on Advanced VideoBased Surveillance Systems, 2001: http://personal.ee.surrey.ac.uk/Personal/R.Bowden/publications/avbs01/avbs01.pdf
The contructors
Parameters: 


Default constructor sets all parameters to default values.
Updates the background model and returns the foreground mask
Parameters are the same as in BackgroundSubtractor::operator()
Gaussian Mixturebased Backbround/Foreground Segmentation Algorithm.
Here are important members of the class that control the algorithm, which you can set after constructing the class instance:
Maximum allowed number of mixture comonents. Actual number is determined dynamically per pixel.
Threshold defining whether the component is significant enough to be included into the background model ( corresponds to TB=1cf from the paper??which paper??). 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 Prati,Mikic,Trivedi,Cucchiarra, Detecting Moving Shadows..., IEEE PAMI,2003.
The class implements the Gaussian mixture model background subtraction described in:
 Z.Zivkovic, Improved adaptive Gausian mixture model for background subtraction, International Conference Pattern Recognition, UK, August, 2004, http://www.zoranz.net/Publications/zivkovic2004ICPR.pdf. The code is very fast and performs also shadow detection. Number of Gausssian components is adapted per pixel.
 Z.Zivkovic, F. van der Heijden, Efficient Adaptive Density Estimapion per Image Pixel for the Task of Background Subtraction, Pattern Recognition Letters, vol. 27, no. 7, pages 773780, 2006. The algorithm similar to the standard Stauffer&Grimson algorithm with additional selection of the number of the Gaussian components based on: Z.Zivkovic, F.van der Heijden, Recursive unsupervised learning of finite mixture models, IEEE Trans. on Pattern Analysis and Machine Intelligence, vol.26, no.5, pages 651656, 2004.
The constructors.
Parameters: 


Updates the background model and computes the foreground mask
Returns background image
See BackgroundSubtractor::getBackgroundImage().
[Bouguet00]  JeanYves Bouguet. Pyramidal Implementation of the Lucas Kanade Feature Tracker. 
[Bradski98]  Bradski, G.R. “Computer Vision Face Tracking for Use in a Perceptual User Interface”, Intel, 1998 
[Bradski00]  Davis, J.W. and Bradski, G.R. “Motion Segmentation and Pose Recognition with Motion History Gradients”, WACV00, 2000 
[Davis97]  Davis, J.W. and Bobick, A.F. “The Representation and Recognition of Action Using Temporal Templates”, CVPR97, 1997 
[Farneback2003]  Gunnar Farneback, Twoframe motion estimation based on polynomial expansion, Lecture Notes in Computer Science, 2003, (2749), , 363370. 
[Horn81]  Berthold K.P. Horn and Brian G. Schunck. Determining Optical Flow. Artificial Intelligence, 17, pp. 185203, 1981. 
[Lucas81]  Lucas, B., and Kanade, T. An Iterative Image Registration Technique with an Application to Stereo Vision, Proc. of 7th International Joint Conference on Artificial Intelligence (IJCAI), pp. 674679. 
[Welch95]  Greg Welch and Gary Bishop “An Introduction to the Kalman Filter”, 1995 