1793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/*M///////////////////////////////////////////////////////////////////////////////////////
2793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
3793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
5793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//  By downloading, copying, installing or using the software you agree to this license.
6793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//  If you do not agree to this license, do not download, install,
7793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//  copy or use the software.
8793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
9793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
10793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//                          License Agreement
11793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//                For Open Source Computer Vision Library
12793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
13793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
16793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// Third party copyrights are property of their respective owners.
17793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
18793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// Redistribution and use in source and binary forms, with or without modification,
19793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// are permitted provided that the following conditions are met:
20793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
21793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//   * Redistribution's of source code must retain the above copyright notice,
22793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//     this list of conditions and the following disclaimer.
23793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
24793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//   * Redistribution's in binary form must reproduce the above copyright notice,
25793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//     this list of conditions and the following disclaimer in the documentation
26793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//     and/or other materials provided with the distribution.
27793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
28793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//   * The name of the copyright holders may not be used to endorse or promote products
29793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//     derived from this software without specific prior written permission.
30793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
31793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// This software is provided by the copyright holders and contributors "as is" and
32793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// any express or implied warranties, including, but not limited to, the implied
33793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// warranties of merchantability and fitness for a particular purpose are disclaimed.
34793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// In no event shall the Intel Corporation or contributors be liable for any direct,
35793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// indirect, incidental, special, exemplary, or consequential damages
36793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// (including, but not limited to, procurement of substitute goods or services;
37793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// loss of use, data, or profits; or business interruption) however caused
38793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// and on any theory of liability, whether in contract, strict liability,
39793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// or tort (including negligence or otherwise) arising in any way out of
40793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// the use of this software, even if advised of the possibility of such damage.
41793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
42793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//M*/
43793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
44793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifndef __OPENCV_TRACKING_C_H__
45793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define __OPENCV_TRACKING_C_H__
46793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
47793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#include "opencv2/imgproc/types_c.h"
48793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
49793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef __cplusplus
50793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslerextern "C" {
51793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif
52793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
53793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/** @addtogroup video_c
54793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler  @{
55793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler*/
56793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
57793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/****************************************************************************************\
58793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler*                                  Motion Analysis                                       *
59793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler\****************************************************************************************/
60793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
61793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/************************************ optical flow ***************************************/
62793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
63793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define CV_LKFLOW_PYR_A_READY       1
64793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define CV_LKFLOW_PYR_B_READY       2
65793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define CV_LKFLOW_INITIAL_GUESSES   4
66793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define CV_LKFLOW_GET_MIN_EIGENVALS 8
67793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
68793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* It is Lucas & Kanade method, modified to use pyramids.
69793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler   Also it does several iterations to get optical flow for
70793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler   every point at every pyramid level.
71793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler   Calculates optical flow between two images for certain set of points (i.e.
72793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler   it is a "sparse" optical flow, which is opposite to the previous 3 methods) */
73793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerCVAPI(void)  cvCalcOpticalFlowPyrLK( const CvArr*  prev, const CvArr*  curr,
74793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                     CvArr*  prev_pyr, CvArr*  curr_pyr,
75793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                     const CvPoint2D32f* prev_features,
76793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                     CvPoint2D32f* curr_features,
77793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                     int       count,
78793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                     CvSize    win_size,
79793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                     int       level,
80793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                     char*     status,
81793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                     float*    track_error,
82793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                     CvTermCriteria criteria,
83793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                     int       flags );
84793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
85793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
86793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Modification of a previous sparse optical flow algorithm to calculate
87793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler   affine flow */
88793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerCVAPI(void)  cvCalcAffineFlowPyrLK( const CvArr*  prev, const CvArr*  curr,
89793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                    CvArr*  prev_pyr, CvArr*  curr_pyr,
90793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                    const CvPoint2D32f* prev_features,
91793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                    CvPoint2D32f* curr_features,
92793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                    float* matrices, int  count,
93793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                    CvSize win_size, int  level,
94793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                    char* status, float* track_error,
95793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                    CvTermCriteria criteria, int flags );
96793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
97793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Estimate rigid transformation between 2 images or 2 point sets */
98793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerCVAPI(int)  cvEstimateRigidTransform( const CvArr* A, const CvArr* B,
99793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                      CvMat* M, int full_affine );
100793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
101793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Estimate optical flow for each pixel using the two-frame G. Farneback algorithm */
102793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerCVAPI(void) cvCalcOpticalFlowFarneback( const CvArr* prev, const CvArr* next,
103793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                        CvArr* flow, double pyr_scale, int levels,
104793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                        int winsize, int iterations, int poly_n,
105793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                        double poly_sigma, int flags );
106793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
107793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/********************************* motion templates *************************************/
108793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
109793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/****************************************************************************************\
110793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler*        All the motion template functions work only with single channel images.         *
111793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler*        Silhouette image must have depth IPL_DEPTH_8U or IPL_DEPTH_8S                   *
112793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler*        Motion history image must have depth IPL_DEPTH_32F,                             *
113793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler*        Gradient mask - IPL_DEPTH_8U or IPL_DEPTH_8S,                                   *
114793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler*        Motion orientation image - IPL_DEPTH_32F                                        *
115793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler*        Segmentation mask - IPL_DEPTH_32F                                               *
116793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler*        All the angles are in degrees, all the times are in milliseconds                *
117793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler\****************************************************************************************/
118793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
119793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Updates motion history image given motion silhouette */
120793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerCVAPI(void)    cvUpdateMotionHistory( const CvArr* silhouette, CvArr* mhi,
121793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                      double timestamp, double duration );
122793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
123793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Calculates gradient of the motion history image and fills
124793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler   a mask indicating where the gradient is valid */
125793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerCVAPI(void)    cvCalcMotionGradient( const CvArr* mhi, CvArr* mask, CvArr* orientation,
126793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                     double delta1, double delta2,
127793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                     int aperture_size CV_DEFAULT(3));
128793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
129793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Calculates average motion direction within a selected motion region
130793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler   (region can be selected by setting ROIs and/or by composing a valid gradient mask
131793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler   with the region mask) */
132793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerCVAPI(double)  cvCalcGlobalOrientation( const CvArr* orientation, const CvArr* mask,
133793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                        const CvArr* mhi, double timestamp,
134793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                        double duration );
135793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
136793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Splits a motion history image into a few parts corresponding to separate independent motions
137793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler   (e.g. left hand, right hand) */
138793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerCVAPI(CvSeq*)  cvSegmentMotion( const CvArr* mhi, CvArr* seg_mask,
139793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                CvMemStorage* storage,
140793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                double timestamp, double seg_thresh );
141793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
142793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/****************************************************************************************\
143793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler*                                       Tracking                                         *
144793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler\****************************************************************************************/
145793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
146793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Implements CAMSHIFT algorithm - determines object position, size and orientation
147793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler   from the object histogram back project (extension of meanshift) */
148793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerCVAPI(int)  cvCamShift( const CvArr* prob_image, CvRect  window,
149793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                        CvTermCriteria criteria, CvConnectedComp* comp,
150793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                        CvBox2D* box CV_DEFAULT(NULL) );
151793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
152793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Implements MeanShift algorithm - determines object position
153793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler   from the object histogram back project */
154793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerCVAPI(int)  cvMeanShift( const CvArr* prob_image, CvRect  window,
155793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                         CvTermCriteria criteria, CvConnectedComp* comp );
156793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
157793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/*
158793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslerstandard Kalman filter (in G. Welch' and G. Bishop's notation):
159793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
160793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler  x(k)=A*x(k-1)+B*u(k)+w(k)  p(w)~N(0,Q)
161793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler  z(k)=H*x(k)+v(k),   p(v)~N(0,R)
162793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler*/
163793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef struct CvKalman
164793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{
165793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    int MP;                     /* number of measurement vector dimensions */
166793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    int DP;                     /* number of state vector dimensions */
167793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    int CP;                     /* number of control vector dimensions */
168793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
169793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    /* backward compatibility fields */
170793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#if 1
171793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    float* PosterState;         /* =state_pre->data.fl */
172793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    float* PriorState;          /* =state_post->data.fl */
173793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    float* DynamMatr;           /* =transition_matrix->data.fl */
174793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    float* MeasurementMatr;     /* =measurement_matrix->data.fl */
175793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    float* MNCovariance;        /* =measurement_noise_cov->data.fl */
176793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    float* PNCovariance;        /* =process_noise_cov->data.fl */
177793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    float* KalmGainMatr;        /* =gain->data.fl */
178793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    float* PriorErrorCovariance;/* =error_cov_pre->data.fl */
179793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    float* PosterErrorCovariance;/* =error_cov_post->data.fl */
180793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    float* Temp1;               /* temp1->data.fl */
181793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    float* Temp2;               /* temp2->data.fl */
182793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif
183793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
184793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    CvMat* state_pre;           /* predicted state (x'(k)):
185793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                    x(k)=A*x(k-1)+B*u(k) */
186793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    CvMat* state_post;          /* corrected state (x(k)):
187793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                    x(k)=x'(k)+K(k)*(z(k)-H*x'(k)) */
188793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    CvMat* transition_matrix;   /* state transition matrix (A) */
189793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    CvMat* control_matrix;      /* control matrix (B)
190793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                   (it is not used if there is no control)*/
191793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    CvMat* measurement_matrix;  /* measurement matrix (H) */
192793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    CvMat* process_noise_cov;   /* process noise covariance matrix (Q) */
193793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    CvMat* measurement_noise_cov; /* measurement noise covariance matrix (R) */
194793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    CvMat* error_cov_pre;       /* priori error estimate covariance matrix (P'(k)):
195793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                    P'(k)=A*P(k-1)*At + Q)*/
196793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    CvMat* gain;                /* Kalman gain matrix (K(k)):
197793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                    K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R)*/
198793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    CvMat* error_cov_post;      /* posteriori error estimate covariance matrix (P(k)):
199793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                    P(k)=(I-K(k)*H)*P'(k) */
200793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    CvMat* temp1;               /* temporary matrices */
201793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    CvMat* temp2;
202793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    CvMat* temp3;
203793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    CvMat* temp4;
204793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    CvMat* temp5;
205793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler} CvKalman;
206793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
207793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Creates Kalman filter and sets A, B, Q, R and state to some initial values */
208793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerCVAPI(CvKalman*) cvCreateKalman( int dynam_params, int measure_params,
209793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                 int control_params CV_DEFAULT(0));
210793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
211793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Releases Kalman filter state */
212793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerCVAPI(void)  cvReleaseKalman( CvKalman** kalman);
213793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
214793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Updates Kalman filter by time (predicts future state of the system) */
215793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerCVAPI(const CvMat*)  cvKalmanPredict( CvKalman* kalman,
216793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler                                      const CvMat* control CV_DEFAULT(NULL));
217793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
218793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Updates Kalman filter by measurement
219793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler   (corrects state of the system and internal matrices) */
220793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerCVAPI(const CvMat*)  cvKalmanCorrect( CvKalman* kalman, const CvMat* measurement );
221793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
222793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define cvKalmanUpdateByTime  cvKalmanPredict
223793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define cvKalmanUpdateByMeasurement cvKalmanCorrect
224793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
225793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/** @} video_c */
226793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
227793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef __cplusplus
228793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler} // extern "C"
229793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif
230793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
231793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
232793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif // __OPENCV_TRACKING_C_H__
233