Code covered by the BSD License

### Highlights from 2D Target tracking using Kalman filter

4.26531
4.3 | 50 ratings Rate this file 74 Downloads (last 30 days) File Size: 801 KB File ID: #14243 Version: 1.1

# 2D Target tracking using Kalman filter

12 Mar 2007 (Updated )

This Demo shows tracking target and prediction next position using kalman filter

File Information
Description

The first just does detection by background subtraction. This can be considered as the ground truth.
The second feeds the detection output into a Kalman filter. The predicted position from the kalman filter (red) is compared against the actual ground truth position (green).
Toby Breckon,
http://www.inf.ed.ac.uk

Required Products Image Acquisition Toolbox
MATLAB release MATLAB 7.3 (R2006b)
MATLAB Search Path
```/
/target tracking using kalman
/target tracking using kalman/DATA```

I don't know how the initialization is done? how the numbers are chosen?

b.m_89@yahoo.com

Comment only

very simple and efficient!

10 Feb 2015 Sajith

### Sajith (view profile)

This algorithm is interesting. I need to simulate any of the multiobject tracking radar algorithms. Can you help me?

01 Feb 2015 freedomYo

### freedomYo (view profile)

23 Jan 2015 Xiang CAo

### Xiang CAo (view profile)

10 Jan 2015 shwe4194

### shwe4194 (view profile)

I found your project on target tracking using kalman filter really interesting and different from the usual image processing programs but i have a few doubts in it.

1. How can we implement it?
2.How will this filter help us in tracking the target?
3.Should we design both hardware and software?
3.If we need not design the hardware, then which one should we use?

kindly respond and help me.

08 Dec 2014 Yossarian

### Yossarian (view profile)

I don't know whether i have misunderstood or not, but some of the important codes are wrong.
In the line 51 of file kalman.m, x(i,:) = (xp + K*([cc(i),cr(i)]' - H*xp))', you just predicte the current position with the current real position and plot them in the same time.
That's why you get such a perfect result.
And I take a reference to other version of Kalman code like this one.
http://www.mathworks.com/matlabcentral/fileexchange/29127-linear-kalman-filter
Just change it to the following code:
x(i+1,:) = (xp + K*([cc(i),cr(i)]' - H*xp))';
Correct me if i'm wrong.

11 Nov 2014 Awais Nazir

### Awais Nazir (view profile)

cool

19 Aug 2014 Minsoo Goh

### Minsoo Goh (view profile)

04 Feb 2014 Fernando

### Fernando (view profile)

Very nice :) Even though you can get better results by deriving a better covariance process noise matrix instead of the simple identity matrix.

11 Aug 2013 lin

### lin (view profile)

cool

17 Dec 2012 Alessandro Crimi

### Alessandro Crimi (view profile)

17 Dec 2012 Alessandro Crimi

### Alessandro Crimi (view profile)

Please ignore my previous comment, the prediction is corret, I miss the transpose x', good job.
Cheers

17 Dec 2012 Alessandro Crimi

### Alessandro Crimi (view profile)

Hi
Please correct me if I miss something.
I think your code is wrong, though it is working.
The state prediction:
xp=A*x(i-1,:)' + Bu
will give as a result the same vector x with the g in the last element.
This matrix
A=[[1,0,0,0]',[0,1,0,0]',[dt,0,1,0]',[0,dt,0,1]'];
multiplied by
xp = [MC/2,MR/2,0,0]'.
It is a bit pointless, since the dt elements will always be cancel out by the last zeros. Then you do correctly the observation step and the algorithm is working, but the prediction practically doesn't exist.

Comment only
12 Nov 2012 Alex

### Alex (view profile)

Good work! Could you send me a link or a document with the explanation of the algorithm?
I don´t know why you include some variables that not are included in Matlab examples. For example: Bu.
The matrix dimensions are also different...

bocatasinpan (at) hotmail.com

Comment only
07 Sep 2012 divya konda

### divya konda (view profile)

hi sir i am doing project on system identification by measuring RSS values and i wil compare it with the offline values and i have to calculate the distance by kernel and kalman can you tel me or send me the code please.
My ID kdivyagupta@yahoo.co.in

04 May 2012 AL Mukhtar

### AL Mukhtar (view profile)

my e-mail is:
u044889@gmail.com

Comment only
18 Sep 2011 siva

### siva (view profile)

How can i apply this code for tracking persons? Iam not able to do it.

12 Sep 2011 mazhiver ana

### mazhiver ana (view profile)

02 Aug 2011 Shane

### Shane (view profile)

Some further explanation of some of the functions would be greatly appreciated!!! I am working on a thesis comparing different methods of object tracking, one is using the Kalman filter.
I am trying to use the same code for a simple video of a person walking past a security camera, the camera is looking straight at the relevant object. When I run the detect.m file using my own video, it starts off great, with the green circle tracking the object, once it goes half way through the video images, the green circle increases in size and the tracking is incomplete. can anyone help me please???

Comment only
30 Jul 2011 Fredy

### Fredy (view profile)

Comment only
18 Mar 2011 JAIRO

### JAIRO (view profile)

I have the same trouble than you Rana mudassar, how did you fix it?..
other question : how can I modify this m-file to detect the ball in a real time with a camera??. thanks

Comment only
25 Feb 2011 Christy

### Christy (view profile)

Hi..I am a beginner in kalman filter..Can you please tell me how kalman filter is predicting the next position of the target.

Comment only
03 Feb 2011 shyam p

### shyam p (view profile)

Your work is very good. This code is tracking red color ball. Could you let me know how to modify this image to track white color ball. you can reply me at shyam6283@gmail.com

16 Jan 2011 Kalla

### Kalla (view profile)

I agree with Nita. What is the job of Kalman filter here?

Comment only
09 Jan 2011 Rana Mudassar Munir

### Rana Mudassar Munir (view profile)

% extract ball

the above code is creating trouble for me...plz help...it says:

??? Undefined function or method 'extractball' for input arguments of type 'double'.

OR samroy73@hotmail.com

24 Sep 2010 Christy

### Christy (view profile)

Thanx for sharing the code..but can u please tell me how have you decided the values of various models(which ofcourse depend on the system used)..i mean which system have you assumed here

Comment only
07 Jun 2010 vo

### vo (view profile)

thanks. But can you make it by wavelet transform?

Comment only
10 May 2010 Nita

### Nita (view profile)

Thanks for sharing the code.
Please can you say how kalman filter helps in tracking .
In this code you have done detection in every frame and this output is provided as the input to the kalman filter.So background subtraction and kalman filter will give similar results.So please can you explain the use of kalman filter here.

Comment only
25 Nov 2009 tam duy

### tam duy (view profile)

thank you... If possible please provide me the algorithm

my email is thanhmilano@gmail.com

12 Sep 2009 Ranga Rao

### Ranga Rao (view profile)

thank you... If possible please provide me the algorithm my email is samindla.ranga@gmail.com

16 Jul 2009 Jun wan

### Jun wan (view profile)

30 Apr 2009 Kamil Wojcicki

### Kamil Wojcicki (view profile)

10 Mar 2009 Hema Gandhi

### Hema Gandhi (view profile)

thank you... can you help me in tracking of the eye ball movement.... my email is hema87@gmail.com

04 Feb 2009 Goh

### Goh (view profile)

Nice job.Is it possible to change ball tracking into hand movement tracking? Can u guide me to modify it?My email is imvionne@hotmail.com.Thank you =)

04 Jan 2009 priyanka chittella

### priyanka chittella (view profile)

i need matlab code for tracking of multi object based on daubechies complex wavelet transform its urgent n if possible give me some information about it

Comment only
24 Sep 2008 David Sánchez
15 Sep 2008 Snigdha Khanum

Matlab code for object tracking using Kalman filter.

15 Sep 2008 Aparna Saha

Matlab code for multi object tracking using kalman filter and SIFT features is needed.If possible send as early as possible.

Comment only
22 Aug 2008 milind ganure
20 Jun 2008 emy shahin
12 Jun 2008 Ali Ganoun

Good work

10 Apr 2008 Sam Hooti

You can make it more visual

09 Apr 2008 anish ?s?u?
05 Mar 2008 ramo lkalka

poor

26 Feb 2008 zhigui Hu
26 Feb 2008 zhigui Hu
19 Feb 2008 apuri sambaiah

good

19 Feb 2008 paakalu sailu

it is simply good

13 Feb 2008 Matt Breg

wel done!! simply but efficient!!

22 Jan 2008 Prince Joveluro

Thanks, it is useful

it is very good. thank you.

21 Nov 2007 Sachin Raka

Some comments are in farsi and there is no documentation. Also you can extend it to more complicated scenarios if you wish.

16 Oct 2007 RAZI Amir

I like Kalman Filter and I like you,Thank you for sharing

amirrazi506(a)yahoo.fr

08 Sep 2007 Dezmond Conner

Nice Work
I build my tracking device and will be great to use a Kalman filterd like yours:)

24 Aug 2007 jagannath nirmal

i want some information about it
i like it
i would like to learn all releted with target tracking using kalman filter
thank you

16 Aug 2007 ihsan ihsan

Great job, Thanks for sharing, May God bless you,

07 Aug 2007 belhaoua abdelkrim

thank you very much, it's very clear.

10 Jul 2007 harika kalashika
10 May 2007 Brian Ho

The programming structure is clear and the approaching strict forward. thank you very much your sharing

07 May 2007 Prasertsak Tiawongsombat

it is clear and enlightens me, thank you

14 Mar 2007 vahid mousavi

i like images...