COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### How to track a ball moving using Kalman filter?

• Follow

```Dear all,

I want to learn to track a moving ball using Kalman filter. Although many tutorial are available, I still have some questions.

1. If we can extract the ball in each frame of the video sequence, we will know the position of the ball. Then, why do we need to use Kalman fiter anymore? What is the job of Kalman filter here?

2. Kalman filter: x(k+1) = A.x(k) + B.u(k) + noise
y(k) = C.x(k) + noise

Then, how do we define A, B, C ? suppose we want to track the moving ball?

3. If we know the previous state x(k-1) and the measurement of the current state y(k), we can compute the estimated state. What is the "measurement" in case of tracking the moving ball?

I would very much appreciate if anybody could help me.
Thank you very much.
```
 0

```On Jan 17, 1:54=A0pm, "Kalla " <ngockhanh0...@gmail.com> wrote:
> Dear all,
>
> I want to learn to track a moving ball using Kalman filter. Although many=
tutorial are available, I still have some questions.
>
> 1. If we can extract the ball in each frame of the video sequence, we wil=
l know the position of the ball. Then, why do we need to use Kalman fiter a=
nymore? What is the job of Kalman filter here?
>
> 2. Kalman filter: x(k+1) =3D A.x(k) + B.u(k) + noise
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 y(k) =3D C.x(k) + noise
>
> Then, how do we define A, B, C ? suppose we want to track the moving ball=
?
>
> 3. If we know the previous state x(k-1) and the measurement of the curren=
t state y(k), we can compute the estimated state. What is the "measurement"=
in case of tracking the moving ball?
>
> I would very much appreciate if anybody could help me.
> Thank you very much.

Hello

1.
As it may not be so easy in some cases to segment the ball due to poor
image quality / size of the tracked object it is useful to have
tracking data available. Object trcking also reduces the computational
cost for object localization.

2.
A is the system matrix that describes how the system behaves if no
external changes occur. For the ball moving in 2D A would be 4 by 4
for example. A can be derived by specifying the appropriate set of
state variables for the system (e.g. position & velocity &
acceleration for a ball) using the equation of motion.

B is  the control matrix it is assumed zero (as there are no known
external forces acting on the system).

C is the observation matrix that maps the state vector to the
measurement vector.

For simplicity, for a moving ball in 2D without gravity:

A =3D [1 0 dt 0; % x =3D x + dt * vx
0 1 0 dt; % y =3D y + dt * vy
0 0 1 0;  % vx =3D vx
0 0 0 1]; % vy =3D vy

B =3D 0;

C =3D [1 0 0 0; % we only measure the positions
0 1 0 0];

3.
You update the state vector estimate by using the measurements.

You may wish to take a look at this example:
http://www.mathworks.com/matlabcentral/fileexchange/5377-learning-the-kalma=
n-filter

Peter
```
 0

1 Replies
302 Views

Similiar Articles:

7/22/2012 4:36:40 AM