**Abstract**

The Kalman filter has long been regarded as the optimal solution to many applications in computer vision for example the tracking objects, prediction and correction tasks. Its use in the analysis of visual motion has been documented frequently, we can use in computer vision and open cv in different applications in reality for example robotics, military image and video, medical applications, security in public and privacy society, etc. In this paper, we investigate the implementation of a Matlab code for a Kalman Filter using three algorithm for tracking and detection objects in video sequences (block-matching (Motion Estimation) and Camshift Meanshift (localization, detection and tracking object)). The Kalman filter is presented in three steps: prediction, estimation (correction) and update. The first step is a prediction for the parameters of the tracking and detection objects. The second step is a correction and estimation of the prediction parameters. The important application in Kalman filter is the localization and tracking mono-objects and multi-objects are given in results. This works presents the extension of an integrated modeling and simulation tool for the tracking and detection objects in computer vision described at different models of algorithms in implementation systems.

**Keywords:** Kalman filter, tracking objects, detection objects, localization, video and image processing, computer vision, embedded system

### **1. Introduction**

The computer vision, from the technological evolution point of view, is the most useful in our days. It is a discipline at the border of computer science, mathematics, physics, neuroscience and various other disciplines, which aims to initiate the specific issues of image and video analysis from 2*D* and 3*D* environment, and to implement a simple object tracking application. This phenomenon provokes a spectacular development of applications in various fields in many sectors of activity: imaging systems, robotics, surveillance systems, identification of interest (automatic annotation and retrieval of video from databases multimedia data), indexing and augmented reality, HMI interaction (gesture and gaze recognition for data entry on computers), etc. These systems are most used in airports, metros, prisons, banks or nuclear power plants, intelligent transport systems, the analytical

approach for medical applications, military imagery with the target weapon, applications security and computer-controlled automatic surveillance (scene surveillance, object tracking and behavior analysis, swimming systems for swimming pool surveillance, to prevent accidents and drowning victims), video conference, driving assistance (reversing radar, speed limiter or cruise control), pedestrian tracking (counting and pedestrian tracking systems using aerial cameras), biometric systems (fingerprints and recognition biometric facial), etc. Such an application uses computer vision techniques: object detection, classification of moving objects and tracking of objects, etc. The main objective is to locate a known object in the image in order to follow it up such as faces, people, hand gestures, cars, etc. The current trend is to lighten the tasks performed by humans by integrating intelligence into these systems. So in computer vision, the tracking of moving objects in a known or unknown environment is commonly studied since the year 1970. Monitoring can be a tool to give visual autonomy to robots. In this case, visual perception is a prerequisite for action and requires learning to establish links between the causes and the actions to be produced in response. Tracking objects can also automate repetitive tasks. Such a monitoring system must be robust to the following real constraints: variations in the lighting of the sequence, change in the pose of the object (front view, profile view), change in scale (change in size of the object), change of appearance, simultaneous movement of the camera and the object, partial and total occlusions, or even the kinematics (for example the space-time constraints) and low processing time (20 images/s). Our aim is to classify these methods efficiently in order to highlight the advantages and disadvantages of each method. This will allow us, later, to choose the most robust algorithm for an object tracking system. The object tracking system uses the method of tracking the region of interest of the object in a video sequence. Several points will be discussed, such as the pretreatment methods, the change of the object and its movement, the change of appearance, the change of scale, and change of illumination. Then we will compare the tracking results for the different video sequences analyzed and show the performance of the implemented algorithm.

"KF" is a set of mathematical equations which provide an efficient (recursive) computation of the means for estimation the state of a process. The KF is very powerful in several aspects: it supports estimates of past, present and even future states and it can do so even when the exact nature of the modeled system tracking and detection objects. The Kalman filter is a corrective predictor filter. In the tracking system objects, this filter looks at an object as it moves, that is, it takes information on the state of the object at the precise moment. Then, it uses this information to predict where the object is in the next frame. For this, it takes as input a measurement vector (position in x, in y, width and height of the object). In

*Estimation for Motion in Tracking and Detection Objects with Kalman Filter*

*DOI: http://dx.doi.org/10.5772/intechopen.92863*

the tracking process, this filter looks at an object as it moves, that is it takes

**2. Different methods of modeling an object**

describe these methods as illustrated in **Figure 2** [4–6].

**Figure 1.**

**47**

*The data flow for a Kalman filter.*

information on the state of the object at the precise moment. In the case of tracking an object in motion, the Kalman filter allows us to estimate the states of motion of the object (and therefore predetermine the areas of motion in the following frames with using the combination for three algorithms (block-matching, Camshift and Kalman Filter)) and thus adds robustness tracking objects. Many authors have studied the Kalman filter in object tracking [1, 2]. In this work, we optimized many criteria in image and video processing application. For example, we can site: time execution, quality and performance in the image and video processing, artifact and noise in a frame, etc., the data flow for Kalman Filter is presented in **Figure 1**.

In a follow-up scenario, an object can be defined as anything that is of interest for further analysis. For example people walking on a road, boats on the sea, fish inside an aquarium, airplanes in the air, cars on the road, a motion hand or face, motion for different objects and multi-objects, etc. It is a collection of objects that may be important to track in a specific area or environment. The implementation of an object tracking system involves designing two main parts, the object representation and the object location. The localization step is based on the representation model of the object and its location in the previous frame. The representation consists in associating with the object followed characteristics of shape and/or appearance allowing to recognize it in successive frames. In recent studies, representations by shape and appearances are classified into three families such as representation by point clouds, representation by bounding boxes (representation by geometric shapes) and representation by silhouettes. In what follows, we will

Tracking corresponds to the estimation of the location of the object in each of the images in a video sequence, the camera and/or the object (face, man, hand, animal, etc.) being able to be simultaneously in motion. The localization process is based on the recognition of the object of interest from a set of visual characteristics (color, shape, speed, etc.). Specifically, the purpose of an object tracking method is to estimate, in each image of the sequence, the functions that are used in tracking the object or objects present in the field of vision of the camera such as motion, color, corners, outline, shape, and object view. In object tracking, the class, appearance, scale, and/or location of the tracking region are predicted based on the forward images and on the underlying model for state transitions. The state of the object is generally represented by its location and its speed.

There are then three main stages in the analysis of the video sequence, the first stage consists in carrying out the detection of moving objects. Then the step of tracking these objects from one image to another and finally, we analyze the tracks of objects to recognize their behavior. Many different techniques for tracking objects have been proposed. The detection events and detection moving objects in complex scenes is difficult to analyze due to camera noise and changing lighting conditions. Each limitation must be overcome in order to avoid failure of the tracking algorithm. In an object tracking algorithm, there are generally four steps: detection, location, association, and trajectory estimation [1–3]. The algorithms are composed by three important modules: block matching and meanshift, camshift, Kalman filter. The Kalman filter is used in a wide range of technological fields. It is a major theme in automation and frame and signal processing. The Kalman filter

*Estimation for Motion in Tracking and Detection Objects with Kalman Filter DOI: http://dx.doi.org/10.5772/intechopen.92863*

"KF" is a set of mathematical equations which provide an efficient (recursive) computation of the means for estimation the state of a process. The KF is very powerful in several aspects: it supports estimates of past, present and even future states and it can do so even when the exact nature of the modeled system tracking and detection objects. The Kalman filter is a corrective predictor filter. In the tracking system objects, this filter looks at an object as it moves, that is, it takes information on the state of the object at the precise moment. Then, it uses this information to predict where the object is in the next frame. For this, it takes as input a measurement vector (position in x, in y, width and height of the object). In the tracking process, this filter looks at an object as it moves, that is it takes information on the state of the object at the precise moment. In the case of tracking an object in motion, the Kalman filter allows us to estimate the states of motion of the object (and therefore predetermine the areas of motion in the following frames with using the combination for three algorithms (block-matching, Camshift and Kalman Filter)) and thus adds robustness tracking objects. Many authors have studied the Kalman filter in object tracking [1, 2]. In this work, we optimized many criteria in image and video processing application. For example, we can site: time execution, quality and performance in the image and video processing, artifact and noise in a frame, etc., the data flow for Kalman Filter is presented in **Figure 1**.

### **2. Different methods of modeling an object**

In a follow-up scenario, an object can be defined as anything that is of interest for further analysis. For example people walking on a road, boats on the sea, fish inside an aquarium, airplanes in the air, cars on the road, a motion hand or face, motion for different objects and multi-objects, etc. It is a collection of objects that may be important to track in a specific area or environment. The implementation of an object tracking system involves designing two main parts, the object representation and the object location. The localization step is based on the representation model of the object and its location in the previous frame. The representation consists in associating with the object followed characteristics of shape and/or appearance allowing to recognize it in successive frames. In recent studies, representations by shape and appearances are classified into three families such as representation by point clouds, representation by bounding boxes (representation by geometric shapes) and representation by silhouettes. In what follows, we will describe these methods as illustrated in **Figure 2** [4–6].

**Figure 1.** *The data flow for a Kalman filter.*

approach for medical applications, military imagery with the target weapon, applications security and computer-controlled automatic surveillance (scene surveillance, object tracking and behavior analysis, swimming systems for swimming pool surveillance, to prevent accidents and drowning victims), video conference, driving assistance (reversing radar, speed limiter or cruise control), pedestrian tracking (counting and pedestrian tracking systems using aerial cameras), biometric systems (fingerprints and recognition biometric facial), etc. Such an application uses computer vision techniques: object detection, classification of moving objects and tracking of objects, etc. The main objective is to locate a known object in the image in order to follow it up such as faces, people, hand gestures, cars, etc. The current trend is to lighten the tasks performed by humans by integrating intelligence into these systems. So in computer vision, the tracking of moving objects in a known or unknown environment is commonly studied since the year 1970. Monitoring can be a tool to give visual autonomy to robots. In this case, visual perception is a prerequisite for action and requires learning to establish links between the causes and the actions to be produced in response. Tracking objects can also automate repetitive tasks. Such a monitoring system must be robust to the following real constraints: variations in the lighting of the sequence, change in the pose of the object (front view, profile view), change in scale (change in size of the object), change of appearance, simultaneous movement of the camera and the object, partial and total occlusions, or even the kinematics (for example the space-time constraints) and low processing time (20 images/s). Our aim is to classify these methods efficiently in order to highlight the advantages and disadvantages of each method. This will allow us, later, to choose the most robust algorithm for an object tracking system. The object tracking system uses the method of tracking the region of interest of the object in a video sequence. Several points will be discussed, such as the pretreatment methods, the change of the object and its movement, the change of appearance, the change of scale, and change of illumination. Then we will compare the tracking results for the different video sequences analyzed and show the per-

*Dynamic Data Assimilation - Beating the Uncertainties*

Tracking corresponds to the estimation of the location of the object in each of the images in a video sequence, the camera and/or the object (face, man, hand, animal, etc.) being able to be simultaneously in motion. The localization process is based on the recognition of the object of interest from a set of visual characteristics (color, shape, speed, etc.). Specifically, the purpose of an object tracking method is to estimate, in each image of the sequence, the functions that are used in tracking the object or objects present in the field of vision of the camera such as motion, color, corners, outline, shape, and object view. In object tracking, the class, appearance, scale, and/or location of the tracking region are predicted based on the forward images and on the underlying model for state transitions. The state of the

There are then three main stages in the analysis of the video sequence, the first stage consists in carrying out the detection of moving objects. Then the step of tracking these objects from one image to another and finally, we analyze the tracks of objects to recognize their behavior. Many different techniques for tracking objects have been proposed. The detection events and detection moving objects in complex scenes is difficult to analyze due to camera noise and changing lighting conditions. Each limitation must be overcome in order to avoid failure of the tracking algorithm. In an object tracking algorithm, there are generally four steps: detection, location, association, and trajectory estimation [1–3]. The algorithms are composed by three important modules: block matching and meanshift, camshift, Kalman filter. The Kalman filter is used in a wide range of technological fields. It is a major theme in automation and frame and signal processing. The Kalman filter

formance of the implemented algorithm.

**46**

object is generally represented by its location and its speed.

### *Dynamic Data Assimilation - Beating the Uncertainties*

**Figure 2.** *Object tracking methods.*

1.What representation is appropriate for tracking objects?

2.What algorithm should be used?

3.How is the movement, appearance and shape of the object modeled?

Tracking of events and detection motion objects in complex scenes is difficult to analyze due to camera noise and changing lighting conditions. Each limitation must be overcome in order to avoid failure of the tracking algorithm. In an object tracking algorithm, there are generally four steps: object detection, location, association, and trajectory estimation. We will be interested in this master's work [1, 2, 7] to study the different methods of representing objects in a video sequence.

> from the probability distribution of the image which can have values from 0 to 255. The search window adaptation parameters are computed in Eqs. (1), (2) and (3) [1, 7].

> We calculate the secondary moments using the Eqs. (4), (5) and (6), orientation is calculated by Eq. (7) and the length and width of the object search window (11) and (12).

> > X *y*

X *y*

*M*11

2

*<sup>M</sup>*<sup>00</sup> � *xc* � *yc* � �

� *<sup>M</sup>*<sup>02</sup> *<sup>M</sup>*<sup>00</sup> � *<sup>y</sup>*<sup>2</sup> *c*

� �

X *y*

2 �

� �

*M*20 *<sup>M</sup>*<sup>00</sup> � *<sup>x</sup>*<sup>2</sup> *c*

2 � *b a* � *c* 2

ffiffiffiffiffiffiffiffiffiffi *M*00 <sup>255</sup> <sup>r</sup>

*Lc* ¼ ½ � ð Þ *xc* � ð Þ *W*ð Þ1 *=*2 ð Þ *yc* � ð Þ *W*ð Þ2 *=*2 (3)

*W* ¼ ½ � *s* 1*:*2 � *s* (2)

*<sup>x</sup>*<sup>2</sup> � *I x*ð Þ , *<sup>y</sup>* (4)

*<sup>y</sup>*<sup>2</sup> � *I x*ð Þ , *<sup>y</sup>* (5)

*x* � *y* � *I x*ð Þ , *y* (6)

(1)

(7)

*s* ¼ 2 �

*Estimation for Motion in Tracking and Detection Objects with Kalman Filter*

*DOI: http://dx.doi.org/10.5772/intechopen.92863*

*<sup>M</sup>*<sup>20</sup> <sup>¼</sup> <sup>X</sup> *x*

*<sup>M</sup>*<sup>02</sup> <sup>¼</sup> <sup>X</sup> *x*

*<sup>M</sup>*<sup>11</sup> <sup>¼</sup> <sup>X</sup> *x*

arctan

arctan

*θ* ¼

*Flowchart of the Camshift algorithm for object tracking.*

**Figure 3.**

**49**

*θ* ¼

#### **2.1 Camshift algorithm**

Camshift is an algorithm for tracking objects in real time (people, vehicles). It is based on the colors developed in the video sequence. Camshift is based on the average displacement algorithm (Meanshift). The calculation module is based on iterations to reach convergence. Camshift take the HSV color space as a model with the color tone component ð Þ *Hue* . This component is designed to calculate the probability of the histogram of each image of the analyzed sequence. The size of the original window was just large enough to fit most of the object inside of it. The Camshift algorithm adjusts the size of the search window according to the movement of the object analyzed with constant tint. Whereas, for a quick movement, the follow-up can fall into the analysis of another object in the sequence. For this reason, we choose at the beginning of the algorithm a threshold of color hue of the object to ensure correct tracking. Once the mean displacement module converges, the center of gravity and the zero order moment are calculated. Then we calculate the new size, width and length of the search window. Then, the window is centered around center of gravity and the calculation of the next image is started. Next, we calculate the Camshift parameters such as the secondary moments, the orientation, the width and the length of the window around the object's center of gravity. **Figure 3** shows the flowchart of the Camshift algorithm for object tracking.

#### *2.1.1 Calculation of Camshift parameters*

With each iteration of the Camshift algorithm, the object search window will be resized. To search for the new size, the search window obtained by the average displacement algorithm is slightly enlarged to include the object. Then, the parameters of the window must be adapted such as the width, the length and the center of gravity. The term *M*00*=*255 is the normalized area since the zero order moment is calculated

*Estimation for Motion in Tracking and Detection Objects with Kalman Filter DOI: http://dx.doi.org/10.5772/intechopen.92863*

**Figure 3.** *Flowchart of the Camshift algorithm for object tracking.*

from the probability distribution of the image which can have values from 0 to 255. The search window adaptation parameters are computed in Eqs. (1), (2) and (3) [1, 7].

$$s = 2 \times \sqrt{\frac{\text{M00}}{255}} \tag{1}$$

$$\mathbf{W} = \begin{bmatrix} \mathbf{s} & \mathbf{1.2} \times \mathbf{s} \end{bmatrix} \tag{2}$$

$$L\mathfrak{x} = \left[ (\mathfrak{xc} - (W(\mathfrak{1})/2)) \quad (\mathfrak{yc} - (W(\mathfrak{2})/2)) \right] \tag{3}$$

We calculate the secondary moments using the Eqs. (4), (5) and (6), orientation is calculated by Eq. (7) and the length and width of the object search window (11) and (12).

$$\text{M20} = \sum\_{\mathbf{x}} \sum\_{\mathbf{y}} \mathbf{x}^2 \times I(\mathbf{x}, \mathbf{y}) \tag{4}$$

$$\text{M02} = \sum\_{\mathbf{x}} \sum\_{\mathbf{y}} \mathbf{y}^2 \times I(\mathbf{x}, \mathbf{y}) \tag{5}$$

$$\mathbf{M11} = \sum\_{\mathbf{x}} \sum\_{\mathbf{y}} \mathbf{x} \times \mathbf{y} \times I(\mathbf{x}, \mathbf{y}) \tag{6}$$

$$\begin{aligned} \theta &= \frac{2 \times \left(\frac{M11}{M00} - \text{xc} \times \text{yc}\right)}{\left(\frac{M20}{M000} - \text{x}\_c^2\right) - \left(\frac{M02}{M000} - \text{y}\_c^2\right)} \\ \theta &= \frac{2}{\arctan\frac{2 \times b}{a - c}} \end{aligned} \tag{7}$$

1.What representation is appropriate for tracking objects?

3.How is the movement, appearance and shape of the object modeled?

study the different methods of representing objects in a video sequence.

Tracking of events and detection motion objects in complex scenes is difficult to analyze due to camera noise and changing lighting conditions. Each limitation must be overcome in order to avoid failure of the tracking algorithm. In an object tracking algorithm, there are generally four steps: object detection, location, association, and trajectory estimation. We will be interested in this master's work [1, 2, 7] to

Camshift is an algorithm for tracking objects in real time (people, vehicles). It is

With each iteration of the Camshift algorithm, the object search window will be resized. To search for the new size, the search window obtained by the average displacement algorithm is slightly enlarged to include the object. Then, the parameters of the window must be adapted such as the width, the length and the center of gravity. The term *M*00*=*255 is the normalized area since the zero order moment is calculated

based on the colors developed in the video sequence. Camshift is based on the average displacement algorithm (Meanshift). The calculation module is based on iterations to reach convergence. Camshift take the HSV color space as a model with the color tone component ð Þ *Hue* . This component is designed to calculate the probability of the histogram of each image of the analyzed sequence. The size of the original window was just large enough to fit most of the object inside of it. The Camshift algorithm adjusts the size of the search window according to the movement of the object analyzed with constant tint. Whereas, for a quick movement, the follow-up can fall into the analysis of another object in the sequence. For this reason, we choose at the beginning of the algorithm a threshold of color hue of the object to ensure correct tracking. Once the mean displacement module converges, the center of gravity and the zero order moment are calculated. Then we calculate the new size, width and length of the search window. Then, the window is centered around center of gravity and the calculation of the next image is started. Next, we calculate the Camshift parameters such as the secondary moments, the orientation, the width and the length of the window around the object's center of gravity. **Figure 3** shows the flowchart of the Camshift algorithm for object tracking.

2.What algorithm should be used?

*Dynamic Data Assimilation - Beating the Uncertainties*

*2.1.1 Calculation of Camshift parameters*

**48**

**2.1 Camshift algorithm**

**Figure 2.**

*Object tracking methods.*

*Dynamic Data Assimilation - Beating the Uncertainties*

$$a = \frac{M20}{M00} - x\_c^2 \tag{8}$$

*zk* ¼ *H* � *xk* þ *vk* (15)

*p w*ð Þ� *<sup>k</sup> N*ð Þ 0, *Q* (16) *p v*ð Þ� *<sup>k</sup> N*ð Þ 0, *R* (17)

*xk* ¼ ð Þ *x*, *y*, *x*\_, *y*\_, *x*€, €*y* (18)

*<sup>k</sup>* (19)

*ek* ¼ *xk* � *x*^*<sup>k</sup>* (20)

*k*

is called measurement innovation. This difference

(21)

(22)

*A* is the transition matrix and *H* presents the measurement matrix. Random variables *wk* and *vk* present Gaussian and measurement noise (respectively). They are assumed to be independent (from each other), the covariance of *wk* is a matrix

The Matrix *A* models the movement of the object. The movement model used is generally at constant speed or at constant acceleration. Since the movement of objects is not uniform, this type of model is not suitable for describing all movements in general. However, we assume that the object movements that we consider in the third chapter have an adapted dynamic. In our case, we use the motion model with constant acceleration, for tracking a point in two dimensions. The state vector is written:

where ð Þ *x*, *y* is the position, ð Þ *x*\_, *y*\_ presents the speed and ð Þ *x*€, €*y* is the acceleration. Note that in the object tracking application, the noise covariance matrices (*Q*, *R*), the transition matrix *A* and the measurement matrix are assumed to be constant. The variable parameters over time are the state vector and the measurement vector

*<sup>k</sup>* the estimation of a priori states at the moment *k* and we give

knowledge of the prior process at the moment *k*, and *x*^*<sup>k</sup>* the estimate of the state a posteriori at the moment *k* which is given to the measurement vector *zk* (15). We can then define the a priori and a posteriori estimation errors by the following

*<sup>k</sup>* ¼ *xk* � *x*^�

For computing statistics for the Kalman filter, we start with the goal of finding an equation that computes an a posteriori state estimate as a linear combination of an a priori estimate and a weighted difference between an actual measure *zk* and a

*<sup>k</sup>* þ *K* � *zk* � *H* � *x*^�

reflects the difference between the predicted measurement and the actual measurement. The *K* matrix of dimension *n* � *m* in the previous equation (**??**), is chosen to be the gain or the mixing factor which minimizes the covariance of the posterior

The covariance of the a priori estimation error is illustrated by Eq. (21):

since the position and size of the object changes during the sequence.

*e* �

*P*� *<sup>k</sup>* ¼ *E e*� *k e* �*T k*

measurement prediction *Hx*^*<sup>k</sup>* as shown in the equation below (22):

*x*^� *<sup>k</sup>* ¼ *x*^�

*k*

error. The gain of the Kalman filter is of the following form (23):

The difference *zk* � *H* � *x*^�

**51**

**2.3 The origins of filter formulation**

We define *x*^�

Eqs. (19) and (20).

*Q* (16), similarly the covariance of *vk* is a matrix "R" (17).

*DOI: http://dx.doi.org/10.5772/intechopen.92863*

*Estimation for Motion in Tracking and Detection Objects with Kalman Filter*

$$b = 2 \times \left(\frac{\mathbf{M11}}{\mathbf{M00}} - \mathbf{x}\_{\varepsilon} \times \mathbf{y}\_{\varepsilon}\right) \tag{9}$$

$$\mathbf{c} = \mathbf{2} \times \left(\frac{\text{M02}}{\text{M00}} - \text{y}\_c^2\right) \tag{10}$$

$$l = \sqrt{\frac{\left(a+c\right) + \sqrt{b^2 + \left(a-c\right)^2}}{2}} \tag{11}$$

$$w = \sqrt{\frac{\left(a+c\right) - \sqrt{b^2 + \left(a-c\right)^2}}{2}} \tag{12}$$

#### **2.2 Kalman filter**

#### *2.2.1 Definition*

The Kalman filter is a set of mathematical equations which provide an efficient (recursive) computation of the means for estimation the state of a process, so as to minimize the mean of the quadratic error. The filter is very powerful in several aspects: it supports estimates of past, present and even future states and it can do so even when the exact nature of the modeled system is unknown. The filter allows, thanks to its role, to correct and restrict the areas in which we seek movement in the next step. We can see the quadratic error by Eq. (13).

$$E\_{\mathbf{x}} = \mathbf{x}\_{kalman} - \mathbf{x}\_{tracking} \tag{13}$$

#### *2.2.2 Role of the Kalman filter in the tracking application*

The Kalman filter is used in a wide range of technological. In the tracking and detection process, this filter looks at an object as it moves, that is, it takes information on the state of the object at the precise moment. Then, it uses this information to predict where the object is in the next frame. For this, it takes as input a measurement vector (position in x, in y, width and height of the object). Then it acts on so-called internal parameters (position, speed and acceleration in x and y, as well as the height, the width) to make a prediction and then an estimate of these. Finally, the result is an estimate of the following measurement. In the case of tracking an object in motion, the Kalman filter allows us to estimate the states of motion of the object. Many authors have studied the Kalman filter in object tracking [1, 8, 9], the differences of the present work and the earlier works are the type and the method of objects tracking.

#### *2.2.3 Formulation and modeling of the Kalman filter*

The main objective of the Kalman filter is to estimate the vector of states in a discrete time. This process is illustrated by Eq. (14) with stochastic linear differences:

$$\mathbf{x}\_{k} = \mathbf{A} \times \mathbf{x}\_{k-1} + \mathbf{w}\_{k-1} \tag{14}$$

With a measurement vector which has the following form (15):

*Estimation for Motion in Tracking and Detection Objects with Kalman Filter DOI: http://dx.doi.org/10.5772/intechopen.92863*

$$z\_k = H \times \mathbf{x}\_k + v\_k \tag{15}$$

*A* is the transition matrix and *H* presents the measurement matrix. Random variables *wk* and *vk* present Gaussian and measurement noise (respectively). They are assumed to be independent (from each other), the covariance of *wk* is a matrix *Q* (16), similarly the covariance of *vk* is a matrix "R" (17).

$$p(w\_k) \sim N(0, Q) \tag{16}$$

$$p(v\_k) \sim N(0, R) \tag{17}$$

The Matrix *A* models the movement of the object. The movement model used is generally at constant speed or at constant acceleration. Since the movement of objects is not uniform, this type of model is not suitable for describing all movements in general. However, we assume that the object movements that we consider in the third chapter have an adapted dynamic. In our case, we use the motion model with constant acceleration, for tracking a point in two dimensions. The state vector is written:

$$\mathbf{x}\_{k} = (\mathbf{x}, \mathbf{y}, \dot{\mathbf{x}}, \dot{\mathbf{y}}, \ddot{\mathbf{x}}, \ddot{\mathbf{y}}) \tag{18}$$

where ð Þ *x*, *y* is the position, ð Þ *x*\_, *y*\_ presents the speed and ð Þ *x*€, €*y* is the acceleration. Note that in the object tracking application, the noise covariance matrices (*Q*, *R*), the transition matrix *A* and the measurement matrix are assumed to be constant. The variable parameters over time are the state vector and the measurement vector since the position and size of the object changes during the sequence.

#### **2.3 The origins of filter formulation**

We define *x*^� *<sup>k</sup>* the estimation of a priori states at the moment *k* and we give knowledge of the prior process at the moment *k*, and *x*^*<sup>k</sup>* the estimate of the state a posteriori at the moment *k* which is given to the measurement vector *zk* (15). We can then define the a priori and a posteriori estimation errors by the following Eqs. (19) and (20).

$$
\bar{e\_k}^- = \mathfrak{x}\_k - \hat{\mathfrak{x}}\_k^- \tag{19}
$$

$$
\varepsilon\_k = \varkappa\_k - \hat{\varkappa}\_k \tag{20}
$$

The covariance of the a priori estimation error is illustrated by Eq. (21):

$$P\_k^- = E\left[e\_k^- e\_k^{-T}\right] \tag{21}$$

For computing statistics for the Kalman filter, we start with the goal of finding an equation that computes an a posteriori state estimate as a linear combination of an a priori estimate and a weighted difference between an actual measure *zk* and a measurement prediction *Hx*^*<sup>k</sup>* as shown in the equation below (22):

$$
\hat{\mathfrak{x}}\_k^- = \hat{\mathfrak{x}}\_k^- + K \times \left(\mathbf{z}\_k - H \times \hat{\mathfrak{x}}\_k^-\right) \tag{22}
$$

The difference *zk* � *H* � *x*^� *k* is called measurement innovation. This difference reflects the difference between the predicted measurement and the actual measurement. The *K* matrix of dimension *n* � *m* in the previous equation (**??**), is chosen to be the gain or the mixing factor which minimizes the covariance of the posterior error. The gain of the Kalman filter is of the following form (23):

*<sup>a</sup>* <sup>¼</sup> *<sup>M</sup>*<sup>20</sup>

*M*11

*b* ¼ 2 �

*l* ¼

*Dynamic Data Assimilation - Beating the Uncertainties*

*w* ¼

next step. We can see the quadratic error by Eq. (13).

*2.2.2 Role of the Kalman filter in the tracking application*

the method of objects tracking.

differences:

**50**

*2.2.3 Formulation and modeling of the Kalman filter*

**2.2 Kalman filter**

*2.2.1 Definition*

*c* ¼ 2 �

ð Þþ *a* þ *c*

ð Þ� *a* þ *c*

*<sup>M</sup>*<sup>00</sup> � *<sup>x</sup>*<sup>2</sup>

*M*02 *<sup>M</sup>*<sup>00</sup> � *<sup>y</sup>*<sup>2</sup> *c*

q

*<sup>M</sup>*<sup>00</sup> � *xc* � *yc* � �

� �

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi

2

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi

2

q

The Kalman filter is a set of mathematical equations which provide an efficient (recursive) computation of the means for estimation the state of a process, so as to minimize the mean of the quadratic error. The filter is very powerful in several aspects: it supports estimates of past, present and even future states and it can do so even when the exact nature of the modeled system is unknown. The filter allows, thanks to its role, to correct and restrict the areas in which we seek movement in the

The Kalman filter is used in a wide range of technological. In the tracking and detection process, this filter looks at an object as it moves, that is, it takes information on the state of the object at the precise moment. Then, it uses this information

The main objective of the Kalman filter is to estimate the vector of states in a

discrete time. This process is illustrated by Eq. (14) with stochastic linear

With a measurement vector which has the following form (15):

to predict where the object is in the next frame. For this, it takes as input a measurement vector (position in x, in y, width and height of the object). Then it acts on so-called internal parameters (position, speed and acceleration in x and y, as well as the height, the width) to make a prediction and then an estimate of these. Finally, the result is an estimate of the following measurement. In the case of tracking an object in motion, the Kalman filter allows us to estimate the states of motion of the object. Many authors have studied the Kalman filter in object tracking [1, 8, 9], the differences of the present work and the earlier works are the type and

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi *<sup>b</sup>*<sup>2</sup> <sup>þ</sup> ð Þ *<sup>a</sup>* � *<sup>c</sup>*

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi *<sup>b</sup>*<sup>2</sup> <sup>þ</sup> ð Þ *<sup>a</sup>* � *<sup>c</sup>*

2

2

vuut (12)

*Ex* ¼ *xKalman* � *xtracking* (13)

*xk* ¼ *A* � *xk*�<sup>1</sup> þ *wk*�<sup>1</sup> (14)

vuut (11)

*<sup>c</sup>* (8)

(9)

(10)

$$K\_k = P\_k^- \times H^T \times \left(H \times P\_k^- \times H^T + R\right)^{-1} \tag{23}$$

The measurement vector of the Kalman filter is composed of the initial position, the length and the width of the search window for the object at time *tk*. This vector

� � (25)

*sk* ¼ *A* � *sk*�<sup>1</sup> þ *wk*�<sup>1</sup> (26)

1

CCCCCCCCA

*zk* ¼ *H* � *sk* þ *vk* (28)

1

CCCA

*p w*ð Þ� *N*ð Þ 0, *Q* (30) *p v*ð Þ� *N*ð Þ 0, *R* (31)

(27)

(29)

(32)

*zk* ¼ *xk*; *yk*;*Wk*; *Lk*

The Kalman filter estimates the state "s" of a discrete process, this state is

the difference between the two instants *k* and *k* � 1 (dt = 1).

0

*Estimation for Motion in Tracking and Detection Objects with Kalman Filter*

BBBBBBBB@

*A* ¼

• The measurement model is defined by the Eq. (28).

*H* ¼

0

BBB@

distributions which are presented by Eqs. (30) and (31) [9, 10]:

The noise process is of the following form (32):

**53**

With *H* (29) presents the measurement matrix:

With "A" (27) is the transition matrix, *wk* is the process noise and *dt* represents

1 0 *dt* 0 00 01 0 *dt* 0 0 001 0 00 000 1 00 000 0 1 0 000 0 01

1 00000 01 0000 001 000 0001 00

The two vectors *sk* and *zk* present the state and the measure at the moment *k*, *N* is the integer vector. Process noise "*wk*�<sup>1</sup>" and measurement "*vk*" are assumed to be independent of the state and measurement vectors and to the normal and white

1

CCCCCCCCA

0

BBBBBBBB@

*wk*�<sup>1</sup> ¼

is given by the Eq. (25):

*DOI: http://dx.doi.org/10.5772/intechopen.92863*

**3.1 Process to estimate**

modeled by the linear Eq. (26):

The use of a Kalman filter then allows us to estimate the parameters for tracking objects. However, the Kalman filter does not allow the moving element or these parameters to be extracted in the frame. We will first propose a method for detecting the moving object in the frame or video sequence. The fact that we used a robust, reliable and precise tracking algorithm greatly helped us to extract the two measurement and state vectors for the initialization of the Kalman filter (the inputs of the Kalman filter).

### **3. Different function of the Kalman filter**

The Kalman filter is an optimal recursive estimator to the linear filtering problem Data. This filter has two necessary modules, a prediction module and a correction or estimation module. The Kalman filter then makes it possible to estimate the position of the object by achieving a compromise between the position observed in the frame and the predicted position. The input parameters of the Kalman filter are respectively, the position of the object in the frame at time "k," the size of the object and the width and length of the object search window which are variable due to the mobility of the object during the sequence. These parameters represent the state vector and the filter measurement vector from Kalman filter. From the works that are studied in the literature [1, 4, 5], we chose the Kalman filter for estimating the tracking parameters. **Figure 4** shows the Kalman filter cycle [8–10]. Generally the estimation of the tracking parameters with a Kalman filter is a process requires the following steps: itemize.

The measure which consists in taking the tracking parameters computed in the Camshift algorithm.

The estimate, which updates the position of the object.

The prediction, which computes the position of the object in the next frame.

The variable parameters of the Kalman filter are the state vector and the measurement vector:

The state vector is composed by the initial position, the width and the length of the search window as well as the center of gravity of the object *xc*; *yc* at time *tk*. This vector is presented by the following Eq. (24):

$$\mathbf{s}\_k = \left( \mathbf{x}\_k; \mathbf{y}\_k; \mathcal{W}\_k; L\_k; \mathbf{x}\_c; \mathbf{y}\_c \right) \tag{24}$$

**Figure 4.** *Kalman filter cycle.*

*Estimation for Motion in Tracking and Detection Objects with Kalman Filter DOI: http://dx.doi.org/10.5772/intechopen.92863*

The measurement vector of the Kalman filter is composed of the initial position, the length and the width of the search window for the object at time *tk*. This vector is given by the Eq. (25):

$$x\_k = \left(\mathbf{x}\_k; \mathbf{y}\_k; W\_k; L\_k\right) \tag{25}$$

#### **3.1 Process to estimate**

*Kk* ¼ *P*�

*Dynamic Data Assimilation - Beating the Uncertainties*

**3. Different function of the Kalman filter**

of the Kalman filter).

following steps: itemize.

Camshift algorithm.

surement vector:

**Figure 4.** *Kalman filter cycle.*

**52**

*<sup>k</sup>* � *<sup>H</sup><sup>T</sup>* � *<sup>H</sup>* � *<sup>P</sup>*�

The use of a Kalman filter then allows us to estimate the parameters for tracking objects. However, the Kalman filter does not allow the moving element or these parameters to be extracted in the frame. We will first propose a method for

detecting the moving object in the frame or video sequence. The fact that we used a robust, reliable and precise tracking algorithm greatly helped us to extract the two measurement and state vectors for the initialization of the Kalman filter (the inputs

The Kalman filter is an optimal recursive estimator to the linear filtering problem Data. This filter has two necessary modules, a prediction module and a correction or estimation module. The Kalman filter then makes it possible to estimate the position of the object by achieving a compromise between the position observed in the frame and the predicted position. The input parameters of the Kalman filter are respectively, the position of the object in the frame at time "k," the size of the object and the width and length of the object search window which are variable due to the mobility of the object during the sequence. These parameters represent the state vector and the filter measurement vector from Kalman filter. From the works that are studied in the literature [1, 4, 5], we chose the Kalman filter for estimating the tracking parameters. **Figure 4** shows the Kalman filter cycle [8–10]. Generally the estimation of the tracking parameters with a Kalman filter is a process requires the

The measure which consists in taking the tracking parameters computed in the

The prediction, which computes the position of the object in the next frame. The variable parameters of the Kalman filter are the state vector and the mea-

The state vector is composed by the initial position, the width and the length of

*sk* ¼ *xk*; *yk*;*Wk*; *Lk*; *xc*; *yc*

(24)

at time *tk*.

The estimate, which updates the position of the object.

This vector is presented by the following Eq. (24):

the search window as well as the center of gravity of the object *xc*; *yc*

*<sup>k</sup>* � *<sup>H</sup><sup>T</sup>* <sup>þ</sup> *<sup>R</sup>* �<sup>1</sup> (23)

The Kalman filter estimates the state "s" of a discrete process, this state is modeled by the linear Eq. (26):

$$\mathfrak{s}\_k = A \times \mathfrak{s}\_{k-1} + \mathfrak{w}\_{k-1} \tag{26}$$

With "A" (27) is the transition matrix, *wk* is the process noise and *dt* represents the difference between the two instants *k* and *k* � 1 (dt = 1).

$$A = \begin{pmatrix} 1 & 0 & dt & 0 & 0 & 0 \\ 0 & 1 & 0 & dt & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 \end{pmatrix} \tag{27}$$

• The measurement model is defined by the Eq. (28).

$$z\_k = H \times s\_k + v\_k \tag{28}$$

With *H* (29) presents the measurement matrix:

$$H = \begin{pmatrix} \mathbf{1} & \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{0} \\ \mathbf{0} & \mathbf{1} & \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{0} \\ \mathbf{0} & \mathbf{0} & \mathbf{1} & \mathbf{0} & \mathbf{0} & \mathbf{0} \\ \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{1} & \mathbf{0} & \mathbf{0} \end{pmatrix} \tag{29}$$

The two vectors *sk* and *zk* present the state and the measure at the moment *k*, *N* is the integer vector. Process noise "*wk*�<sup>1</sup>" and measurement "*vk*" are assumed to be independent of the state and measurement vectors and to the normal and white distributions which are presented by Eqs. (30) and (31) [9, 10]:

$$p(w) \sim N(0, Q) \tag{30}$$

$$p(v) \sim N(0, R) \tag{31}$$

The noise process is of the following form (32):

$$w\_{k-1} = \begin{pmatrix} 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \end{pmatrix} \tag{32}$$

The measurement noise is presented by the dimension matrix 4ð Þ � 1 (33):

$$v\_k = \begin{pmatrix} \mathbf{0.1} \\ \mathbf{0.1} \\ \mathbf{0} \\ \mathbf{0} \end{pmatrix} \tag{33}$$

So the noise and measurement process covariances are deduced from *wk*�<sup>1</sup> and *vk* by matrices (34) and (35):

$$Q = \begin{pmatrix} \mathbf{1} & \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{0} \\ \mathbf{0} & \mathbf{1} & \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{0} \\ \mathbf{0} & \mathbf{0} & \mathbf{1} & \mathbf{0} & \mathbf{0} & \mathbf{0} \\ \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{1} & \mathbf{0} & \mathbf{0} \\ \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{1} & \mathbf{0} \\ \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{1} \end{pmatrix} \tag{34}$$
 
$$R = \begin{pmatrix} \mathbf{0}.\mathbf{1} & \mathbf{0} & \mathbf{0} & \mathbf{0} \\ \mathbf{0} & \mathbf{0}.\mathbf{1} & \mathbf{0} & \mathbf{0} \\ \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{0} \\ \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{0} \end{pmatrix} \tag{35}$$

#### **3.2 The update equations**

Finally, the output equations for the two prediction and correction blocks of the Kalman filter are:

• Prediction Eqs. (36) and (37):

$$
\hat{s}\_k = \mathcal{A} \times \hat{s}\_{k-1} \tag{36}
$$

The expression for the estimation error is presented by Eq. (41). We applied this

*Ex* ¼ *xKalman* � *xCamshift* (41)

**Execution time Execution time Execution time**

implemented algorithm for tracking object in a video sequence (Camshift algorithm

**NFr x y W L** *xc yc x*KF *y*KF *W*KF *L*KF *x*cKF *y*cKF 2 52 63 58 71 87.35 91.50 69 53 53 63 87.19 91.49 10 55 67 58 71 90.62 96.41 69 55 55 67 89.80 95.68 15 55 68 58 71 90.05 96.93 55 69 55 68 89.58 96.81 25 54 65 58 71 89.52 94.20 56 65 69 56 90.04 93.27 35 54 55 58 71 89.18 83.92 55 55 69 55 89.28 83.72 45 48 56 58 71 83.45 85.26 49 57 69 49 83.36 85.37 55 46 63 58 71 81.56 92.43 46 64 69 46 80.97 92.44 65 43 65 58 71 78.52 93.53 44 69 69 44 78.49 93.37 75 43 63 58 71 78.73 92.46 43 64 69 43 77.98 92.59 85 36 57 58 71 71.41 85.59 37 57 69 37 71.03 85.34 99 38 62 58 71 73.80 91.03 39 63 69 39 73.91 91.26

*Estimation for Motion in Tracking and Detection Objects with Kalman Filter*

*DOI: http://dx.doi.org/10.5772/intechopen.92863*

*The results of the state vectors computed by the tracking algorithm (block-matching and Camshift) and the*

**Video Nbre Histogram Subtraction Skin color Sequence Frames Calculation Background Detection**

Foreman 68 16.51 (s) � 5.21 (s) Redcup 68 19.21 (s) � � Afef 68 17.02 (s) � 10.58(s) PETS2001(1) 68 43.54 (s) 36.56 (s) � PETS2001(2) 68 47.83 (s) 43.29 (s) �

The results of estimation calculation of the tracking parameters with our algorithm (Camshift and Kalman filter) that we obtain in the different test

**4. The results for tracking and detection objects**

*Precision values calculated for skin detection method and execution times.*

We can see the two pre-treatment methods (background subtraction and skin color detection) are the fastest and the histogram calculation method is the slowest.

The fundamental basis for estimating the parameters of tracking by the Kalman filter consists in estimating the state vector*sk* and the measurement vector *zk*. These vectors are calculated by the Camshift algorithm. The parameters of the vectors are the center of

Eq. (41) for all the parameters of the state vectors (x, y, W, L, *xc*, *yc*) of our

and Kalman filter algorithm):

**Table 1.**

**Table 2.**

**55**

*Kalman filter.*

sequence are given in **Table 2**.

$$P\_k^- = \mathbf{A} \times P\_{k-1} \times \mathbf{A}^T + \mathbf{Q} \tag{37}$$

• Correction Eqs. (38), (39) and (40):

$$K\_k = P\_k^- \times H^T \times \left( H \times P\_k^- \times H^T + R \right)^{-1} \tag{38}$$

$$
\hat{\mathbf{s}}\_{k} = \hat{\mathbf{s}}\_{k}^{-} + \mathbf{K}\_{k} \times \left(\mathbf{z}\_{k} - H \times \hat{\mathbf{s}}\_{k}^{-}\right) \tag{39}
$$

$$P\_k = P\_k^- - K\_k \times H \times P\_k^- \tag{40}$$

With *Kk* presents the gain of the Kalman filter at the moment *k*, ^*sk* the state estimated and predicted at the moment *k* and *Pk* is the prediction covariance matrix at time *k*. These three Eqs. (38), (39) and (40) present the output parameters of the Kalman filter. To verify the performance and results of the Kalman filter for estimation the parameters of the object tracking system. We compared the state vector values *xc*, *yc*,*W*, *<sup>L</sup>*, *<sup>x</sup>*, *<sup>y</sup>* � � for the sequence video "Foreman," computed for this filter, with the state vector values obtained by the tracking algorithm. These values are grouped in **Table 1**. It can be seen that the Kalman filter has good values of the state vectors, very close to those obtained by tracking algorithm. This proves the efficiency of the Kalman filter in the estimation of state vectors for tracking objects, the same for measurement vectors.

*Estimation for Motion in Tracking and Detection Objects with Kalman Filter DOI: http://dx.doi.org/10.5772/intechopen.92863*


**Table 1.**

The measurement noise is presented by the dimension matrix 4ð Þ � 1 (33):

0

BBB@

So the noise and measurement process covariances are deduced from *wk*�<sup>1</sup> and

1 00000 01 0000 001 000 0001 00 00001 0 000001

0*:*1 0 00 0 0*:*100 0 0 00 0 0 00

Finally, the output equations for the two prediction and correction blocks of the

1

CCCCCCCCA

1

CCCA

^*sk* ¼ *A* �^*sk*�<sup>1</sup> (36)

*<sup>k</sup>* � *<sup>H</sup><sup>T</sup>* <sup>þ</sup> *<sup>R</sup>* � ��<sup>1</sup> (38)

� � (39)

*<sup>k</sup>* (40)

*<sup>k</sup>* <sup>¼</sup> *<sup>A</sup>* � *Pk*�<sup>1</sup> � *<sup>A</sup><sup>T</sup>* <sup>þ</sup> *<sup>Q</sup>* (37)

� *k*

0*:*1 0*:*1 0 0

1

CCCA

(33)

(34)

(35)

*vk* ¼

*Q* ¼

*Dynamic Data Assimilation - Beating the Uncertainties*

0

BBBBBBBB@

0

BBB@

*R* ¼

*P*�

^*sk* ¼ ^*s* �

*Pk* ¼ *P*�

*<sup>k</sup>* � *<sup>H</sup><sup>T</sup>* � *<sup>H</sup>* � *<sup>P</sup>*�

*<sup>k</sup>* þ *Kk* � *zk* � *H* �^*s*

With *Kk* presents the gain of the Kalman filter at the moment *k*, ^*sk* the state estimated and predicted at the moment *k* and *Pk* is the prediction covariance matrix at time *k*. These three Eqs. (38), (39) and (40) present the output parameters of the Kalman filter. To verify the performance and results of the Kalman filter for estimation the parameters of the object tracking system. We compared the state vector values *xc*, *yc*,*W*, *<sup>L</sup>*, *<sup>x</sup>*, *<sup>y</sup>* � � for the sequence video "Foreman," computed for this filter, with the state vector values obtained by the tracking algorithm. These values are grouped in **Table 1**. It can be seen that the Kalman filter has good values of the state vectors, very close to those obtained by tracking algorithm. This proves the efficiency of the Kalman filter in the estimation of state vectors for tracking objects,

*<sup>k</sup>* � *Kk* � *H* � *P*�

*vk* by matrices (34) and (35):

**3.2 The update equations**

• Prediction Eqs. (36) and (37):

the same for measurement vectors.

**54**

• Correction Eqs. (38), (39) and (40):

*Kk* ¼ *P*�

Kalman filter are:

*The results of the state vectors computed by the tracking algorithm (block-matching and Camshift) and the Kalman filter.*


**Table 2.**

*Precision values calculated for skin detection method and execution times.*

The expression for the estimation error is presented by Eq. (41). We applied this Eq. (41) for all the parameters of the state vectors (x, y, W, L, *xc*, *yc*) of our implemented algorithm for tracking object in a video sequence (Camshift algorithm and Kalman filter algorithm):

$$E\_{\mathbf{x}} = \mathbf{x}\_{\text{Kalman}} - \mathbf{x}\_{\text{Camshjft}} \tag{41}$$

The results of estimation calculation of the tracking parameters with our algorithm (Camshift and Kalman filter) that we obtain in the different test sequence are given in **Table 2**.

We can see the two pre-treatment methods (background subtraction and skin color detection) are the fastest and the histogram calculation method is the slowest.

#### **4. The results for tracking and detection objects**

The fundamental basis for estimating the parameters of tracking by the Kalman filter consists in estimating the state vector*sk* and the measurement vector *zk*. These vectors are calculated by the Camshift algorithm. The parameters of the vectors are the center of

#### *Dynamic Data Assimilation - Beating the Uncertainties*

#### **Figure 5.**

*The trajectory of the gravity center of the face corrected by the Kalman filter.*

gravity of the object *xc*, *yc* , the position in each image ð Þ *<sup>x</sup>*, *<sup>y</sup>* and the width and length of the search window ð Þ *L*,*W* . **Figure 4** shows the trajectory of the gravity center of the face estimated by the Kalman filter. We can see other results in our publications [1–3], there are presents the prediction and correction of trajectory of an different objects (human, car, glass, mono and multi-objects) in different environments (**Figure 5**).

being, a face, a hand, a glass, a car) and that several parameters can influence the

Evaluating the performance of a mobile object tracking system in a video sequence is a complex task which requires the definition of metrics bringing into play concepts specific to video analysis, such as time persistence, precision and

this algorithms give a robust, precise, reliable and fast algorithm.

*The trajectory of the gravity center of the face corrected by the Kalman filter.*

*Estimation for Motion in Tracking and Detection Objects with Kalman Filter*

*DOI: http://dx.doi.org/10.5772/intechopen.92863*

The experimental results obtained indicate that our algorithm (Camshift and the Kalman filter) gives superior results, in terms of precision, reliability and execution time, in comparison with the various methods presented in the literature (for example the KLT (Kanade Lucas Tomasi) algorithm and the classifier algorithm (Adaboost and SVM) [1–3, 7]). In particular, the use of several preprocessing methods to detect the object in each frame of the sequence. The results of the implemented algorithms are the meanshift displacement algorithm and blockmatching, the Camshift algorithm and the Kalman filter, this combination for the

monitoring result.

**Figure 6.**

**57**

execution time for example.

We can see another correction of trajectory of car (in too sequences video) in **Figure 6**.

#### **5. Results discussion**

During the test sequences generated with the different pre-processing methods, we can conclude that object tracking differs from one object to another (a human

#### *Estimation for Motion in Tracking and Detection Objects with Kalman Filter DOI: http://dx.doi.org/10.5772/intechopen.92863*

**Figure 6.** *The trajectory of the gravity center of the face corrected by the Kalman filter.*

being, a face, a hand, a glass, a car) and that several parameters can influence the monitoring result.

The experimental results obtained indicate that our algorithm (Camshift and the Kalman filter) gives superior results, in terms of precision, reliability and execution time, in comparison with the various methods presented in the literature (for example the KLT (Kanade Lucas Tomasi) algorithm and the classifier algorithm (Adaboost and SVM) [1–3, 7]). In particular, the use of several preprocessing methods to detect the object in each frame of the sequence. The results of the implemented algorithms are the meanshift displacement algorithm and blockmatching, the Camshift algorithm and the Kalman filter, this combination for the this algorithms give a robust, precise, reliable and fast algorithm.

Evaluating the performance of a mobile object tracking system in a video sequence is a complex task which requires the definition of metrics bringing into play concepts specific to video analysis, such as time persistence, precision and execution time for example.

gravity of the object *xc*, *yc*

**5. Results discussion**

**Figure 6**.

**56**

**Figure 5.**

, the position in each image ð Þ *<sup>x</sup>*, *<sup>y</sup>* and the width and length of

the search window ð Þ *L*,*W* . **Figure 4** shows the trajectory of the gravity center of the face estimated by the Kalman filter. We can see other results in our publications [1–3], there are presents the prediction and correction of trajectory of an different objects (human,

We can see another correction of trajectory of car (in too sequences video) in

During the test sequences generated with the different pre-processing methods, we can conclude that object tracking differs from one object to another (a human

car, glass, mono and multi-objects) in different environments (**Figure 5**).

*The trajectory of the gravity center of the face corrected by the Kalman filter.*

*Dynamic Data Assimilation - Beating the Uncertainties*
