Adds image to the accumulator.
Parameters: |
|
---|
The function adds src , or some of its elements, to dst :
The function supports multi-channel images; each channel is processed independently.
The functions accumulate* can be used, for example, to collect statistic of background of a scene, viewed by a still camera, for the further foreground-background segmentation.
See also: accumulateSquare() , accumulateProduct() , accumulateWeighted()
Adds the square of the source image to the accumulator.
Parameters: |
|
---|
The function adds the input image src or its selected region, raised to power 2, to the accumulator dst :
The function supports multi-channel images; each channel is processed independently.
See also: accumulateSquare() , accumulateProduct() , accumulateWeighted()
Adds the per-element product of two input images to the accumulator.
Parameters: |
|
---|
The function adds the product of 2 images or their selected regions to the accumulator dst :
The function supports multi-channel images; each channel is processed independently.
See also: accumulate() , accumulateSquare() , accumulateWeighted()
Updates the running average.
Parameters: |
|
---|
The function calculates the weighted sum of the input image src and the accumulator dst so that dst becomes a running average of frame sequence:
that is, alpha regulates the update speed (how fast the accumulator “forgets” about earlier images). The function supports multi-channel images; each channel is processed independently.
See also: accumulate() , accumulateSquare() , accumulateProduct()
Calculates the optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids
Parameters: |
|
---|
The function implements the sparse iterative version of the Lucas-Kanade optical flow in pyramids, see [Bouguet00] .
Computes dense optical flow using Gunnar Farneback’s algorithm
Parameters: |
|
---|
The function finds optical flow for each prevImg pixel using the alorithm so that
Updates the motion history image by a moving silhouette.
Parameters: |
|
---|
The function updates the motion history image as following:
That is, MHI pixels where motion occurs are set to the current timestamp , while the pixels where motion happened last time a long time ago are cleared.
The function, together with calcMotionGradient() and calcGlobalOrientation() , implements the 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 the gradient orientation of a motion history image.
Parameters: |
|
---|
The function calculates the gradient orientation at each pixel as:
(in fact, fastArctan() 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 the global motion orientation in some selected region.
Parameters: |
|
---|
The function calculates the 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 larger weight and the motion occurred in the past has smaller weight, as recorded in mhi .
Finds the 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 adjust the window size and finds the optimal rotation. The function returns the rotated rectangle structure that includes the object position, size and the 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 the object on a back projection image.
Parameters: |
|
---|
The function implements iterative object search algorithm. It takes the object back projection on input 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 pre-filter the back projection and remove the noise (e.g. by retrieving connected components with findContours() , throwing away contours with small area ( contourArea() ) and rendering the remaining contours with drawContours() )
Kalman filter class
class KalmanFilter
{
public:
KalmanFilter();newline
KalmanFilter(int dynamParams, int measureParams, int controlParams=0);newline
void init(int dynamParams, int measureParams, int controlParams=0);newline
// predicts statePre from statePost
const Mat& predict(const Mat& control=Mat());newline
// corrects statePre based on the input measurement vector
// and stores the result to statePost.
const Mat& correct(const Mat& measurement);newline
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)
...
};
The class implements standard Kalman filter http://en.wikipedia.org/wiki/Kalman_filter . However, you can modify transitionMatrix , controlMatrix and measurementMatrix to get the extended Kalman filter functionality. See the OpenCV sample kalman.c