Tuesday, January 16, 2007

Real-Time Color Based Object Tracking



I have been trying to track moving objects for quite some time. I wasn't very successful in modifying my motion detection code to perform motion tracking because shadows were really making life difficult for my program. The program was having difficulties distinguishing the actual object from its shadow. So, I went for a different approach: "color based object tracking". Here's how it works. After the program captures an image from the webcam, it introduces it to a mean filter which causes the image to become blurred. This blurring is done to reduce noise from the image. After doing that, it uses an RGB filter to remove all objects from the image except the object to be tracked (I have to adjust the RGB filter manually for different objects). Then, to make life easier, the program thresholds the image. Thresholding turns the image into a 1-bit binary image. Check out the picture below:


Then, after performing some additional noise removal, it tries to determine the center of the object. See the picture below:


That's it! It's pretty simple, but I had to spend two days experimenting and testing this idea. Check out the video above to see this program tracking a yellow ball. I can't wait to hook this thing up with my floppy drive camera panner! It would be so much fun. :)

Share/Bookmark

126 comments:

kernel_geek said...

Awesome

Anonymous said...

Great stuff!

Anonymous said...

Hi, I just found your blog and I really like the stuff you do. Things I wish I had time to try...
I was wondering if you ever release code and/or compiled programs?

Ashish Derhgawen said...

Glad you found my blog interesting. I release code on CodeProject whenever I feel that something is releasable..and sometimes I also release compiled apps with my posts. :)

Anonymous said...

I found you blog through hackaday
wow thats awesome will you be releasing source code for the object tracker?

Ashish Derhgawen said...

Hello there!

I won't be releasing the source for the object tracker right now. However, I will release it, after a few months.

Anonymous said...

It's been a few months now =)

How bout that source code?

This is too cool not to share!

Matthew said...

I agree..

this is really cool.

I'd be interested in the source as well.

Keep up the good work.

Anurag said...

grt job buddy.........
i was really stunned

i am doin my be project on this topic itself
can u help me with the coding part
my mail id is pratmicro_20@yahoo.co.in

pls send me the ckt diagram,h/w,s/w reqd along with the codes

Anurag said...

pls tell me the codes and h/w s/w reqd along with the ckt diagram

for this object detection and tracker
along with it pls tell me how to calculate distance from the object using laser

Anurag said...

pls tell me the codes and h/w s/w reqd along with the ckt diagram

for this object detection and tracker
along with it pls tell me how to calculate distance from the object using laser

yo2_sama said...

Yeah..definetely excellent program! Thanks for the help with the laser sketch man, our teacher got impressed with the final result, we just added some functionalities and that was it! The copyright thing remained untouched and we just added our names stating we added the functions. Thanks again Ashish

yo2_sama said...

yep..thanks again for the help man

Frigolit said...

Hey! Really neat app.
I found it while googling around cause I'm also working on building a object tracker using a webcam.
If possible I would like to take a look at the source code for your app.
So if you feel like it, drop me an e-mail at frigolit@gmail.com.
Thanks in advance :)

Anonymous said...

Can you send me the source code? I would like to do some experimenting with this.

paul.schowDNOSPAM@gmail.com

you have to remove DNOSPAM

Pedro Moreira said...

Hello Ashish,
I found your blog and I was astonished by your work capacity.

Have you released the source code yet?

If so, plz mail it to
pedro_silva_moreira@hotmail.com

If not, did you use matlab or did all image processing in c#?

Keep up the great work!!

hendrix said...

hi....ashish,
great job.........
i realy-realy interest to do about it
please sent me the source code

my email hendrixk4@gmail.com

thanks before......

ranjitha said...

hi
i am raga ranjitha.my b.tech project is the same as the one u r doing.please mail me ur code on color based object tracking.

raga said...

hi
Im ranjitha. my btech project is the same as the one you are doing. plz mail me ur code on colour based object tracking.

mike said...

hi ashish,
i can't describe how wonderfull your work seems!!
your project is my finall project at my college.. iv'e allready find a way of detecting objects' but not tracking one of them..
i'll be more than happy, if you can help me with the code..
my email is- mikeboussiba@gmail.com
thank's..
p.s.
now i'm seeing all your projects, and it's amaizing!!!

Anonymous said...

hi...thks...i m interested in this...can you pls send post up the source code?n what programming language you are using?thks...

Anonymous said...

hey i read through yor blog.. and it was very interesting .. i am doing another project simillar to yours.. i wonder if u could give me some guidance on the source code .. i'm planing to use vb on this project.. yor help will be very usefull for me ..u can mail the full source code on color based tracking to
vngdeadcell@hotmail.com

Antonio V. said...

Great project.
I am doing another simillar project , but in black and white.
Can you mail me the full source code on color tracking to
verdrive@hotmail.com

Thanks.

aLz said...
This comment has been removed by the author.
Ashwin said...

Hey Ashish,
I am Ashwin Vijayakumar, an embedded systems entrepreneur and a robotics hobbyist. Nice blog you have maintained here. Off all your projects, this one (Object Tracker) impressed me a lot, the video clip demonstrates how smooth the algorithm works. Mind if I take a look at your source code? You can keep in touch with me at ashwin@afflatustechtronics.org

Martin said...

Nice Work! :)

Ashwin said...

Hey Ashish,
Can you kindly forward the source code for this application. I would love to work more on it.

Anonymous said...

Great project.

Can you mail me the full source code on color tracking to
saniclee@nate.com

Anonymous said...

Great project.

Can you mail me the full source code on color tracking to
saniclee@nate.com

Min Woo said...

Hello,

I am dying to experimenting with various ways to track objects using video stream such as this. Would you be able to send me the source code to this project so I can try out and see how this is done?

my email is:

loxics(AT)gmail.com

Thank you so much and I love following up on your projects. They are so fascinating!

-min

Anonymous said...

Hello there

i am doing my thesis project on this topic itself,can u help me with the coding part
my mail geraldermac@yahoo.com

pls send me the sourcecode along with the executable application

gerald

Fatih Demir said...

Hi,

My FYP is about real time color tracking.
Can please you mail me source code on color tracking.
Thanks.
eee.fatih.demir@gmail.com

Anonymous said...

Great job w/ everything. Ive got a few questions about the quality of the electronics and how it would affect the program's tracking ability.

manii.troll@gmail.com

Anonymous said...

Nice Job. I am also interested in tracking Moving car Number Plate. Could me send me the source code so that we both can work on this project. my email id is getbidyut@yahoo.co.in

Anonymous said...

wow its amazing

I'm also working on object tracking...but i'm still unable to get it to work.
can you please mail me your source code...it will help me a lot

pasindu.ed@gmail.com

thanks

Anonymous said...

It looks great! Can you send me the source-code? I neet to track some objects for a school-project! --> shout[(at)]gmx.ch

Thank you very much!

Anonymous said...

It looks great! Can you send me the source-code? I neet to track some objects for a school-project! --> shout[(at)]gmx.ch

Thank you very much!

Anonymous said...

Wow, it's really a nice program!
I'm very interested because my final highschoolproject is about tracking and correcting. Comparable with a self-targeting system. But we just can't figure out how to import a view from a webcam and use it to calculate te coordinates ( on the virtual x and y grid ) of the target! I hope you can help us and maybe send me te source...It's in C++ right?
svsoke@hotmail.com

Thanks in forward,
Stijn van Schooten

Anonymous said...

that is great, can you send me the code, I want to do some experiment like this. thank so much. my email address is : canminhhien@yahoo.com

manohar yadav said...

hi...........
u did superb.......
am also intrested in this one........
want to hav a look on coding part.....

plzzzz send me to manohar.meesala@gmail.com
........
.........
thanq

Anonymous said...

Ashish

I might have an application for this. If you are interested in some contract work, please email me at mrich29357@aol.com

Anonymous said...

Just wondering did you ever release source?

Anonymous said...

ashish,

I am doing a student project using object tracking. I could really use some direction in writing my software so I was wondering if you could send me the source code.

dsangree AT gmail.com

Thanks,

Dan

Anonymous said...

Hi Mr. Derhgawen, I really like your solution, can you tell me if the source code is available, i have a personal project at home i would like to implement.

I'll understand if you don't want to share your code.

my email is stephanemurphy at hotmail dot com
Thank you
Stephane

leo said...

Gud day ashish,

Im Leon. I have an electronincs engineering project w/c more than a half of its part is very similar to your "Motion Tracking" just using a common web cam. The Coordinates, X,Y axis of the Location of the object is my primary concern. I need like that computation of you'rs in finding the coordinates in order for me to make calculations to move a real lethal weapon such as real rifle mounted to turret composed of Servo Motors to move it Vertical and Horizontal such as X,Y axis. Im not realy enhanced to MATHLAB. I may need your Ideas to Succeed with my Engineering. You could be my best resource person. My Email is "tin_bends@yahoo.com" I would be proud if you could add me on you Yahoo Messenger.

If you are willing to share some Ideas on performing my project, please do me a message to my Email.

By the way I titled my project "WEAPON CONTROLLER: AN ALTERNATIVE CONTROLLING MACHINE PREPLACEMENT TO PHYSICAL ARMED WEAPON HANDLING " using VB .Net language for my software. Please help me.

Anonymous said...

can u mail me the information at venugpl10@gmail.com

Anonymous said...

Can i knows how you set your X and y which change with the movement of ball? Is it use any loop function?

Brijesh said...

hey could you please send me source code and documents related to it at birju.chokhra@gmail.com
it s ll be very help to me......
thanks in advance... [:)]

Anonymous said...

hey could you please send me the source code, am workin on a similar project. aedus17@gmail.com

Phong said...

Hi! I'm doing a project in Object tracking.I see your work very cool, awesome.:D
Can I see your code ? My email: tran.thanh.phong.09.01@gmail.com
Thank you very much.

Shung said...

Hello there~
It's so awesome. Actually I've been studying about this tracking system.
If possible please send me source code to study or release code on open source project site

Shung said...

oops.. sorry I forgot to left my email address.
see below :
koshung@gmail.com

Anonymous said...

Wow, increadable work as always.
I didn't see a link to your source code but I would like to get a copy of it please, bkearsons@gmail.com
Thank you.

akshay said...

hi job well done!!!
can u send me codes
akkirocks007@gmail.com

and yes i can send u some of the code i made

Anonymous said...

Hey, great program. i just started fumbling around in matlab to try to figure this out for use in a robotics project. I would greatly appreciate if you can send me some of that code to help me in the right direction

willdrum4food27@yahoo.com

thanks a lot

Anonymous said...

Hi

This is Parth from New Delhi. I really appreciate your work and think that it is really amazing to see how its working.
I have currently completed my 3rd year of computer engineering and was implementing a code which could use your code. In regard to the same, I request you to kindly email me your source code so that I can use a part of it. I will put your name in the acknowledgments and send you a copy of my project.

My email is parth.saxenaREMOVETHIS@gmail.com

Thanks

Anonymous said...

Hey could you please send me your source code

oke2119@yahoo.com

Anonymous said...

i realy interest to do about it. Can you send me the source code?
tokbali9@yahoo.de

Sebastian Böckmann said...

Hello,

nice work. I'm trying to do something like you did. So, could you please send the code to no1@boeckmann.org

Many thanks
Sebastian

sambha said...

Great bro,
Can you mail me the full source code on color tracking to
aeran.aabhas@gmail.com

sambha said...

Great bro,
Can you mail me the full source code on color tracking to
aeran.aabhas@gmail.com

Azif said...

Can U please send me the source code..My mail Id : aalisafa@gmail.com

rupali said...

hi!
u did superb!
m also intrested in the same.
can u plz help me in coding.
my id is roopdhabarde417@yahoo.co.in

Anonymous said...

congratulations! great stuff!

and... please also send me the source code to:

gt ät interad.at

:)
thanks a lot!!

Anonymous said...

hey buddy, what is really impressive. Im currently trying include vision tracking to a robot project i am undertaking and I would like get an idea. Could you plz forward your code to smilin_overlord@hotmail.com

thanks

Anonymous said...

Hey, could you send me the source code for this?
email- joe.prickett@gmail.com
it could really help with a high school project Im working on
thanks in advance

neteraser said...

me too please ! ! ! neteraser@list.ru =)

hEENa!!! said...

Hi Ashish,
I liked your blog a lot... andi need your help.I am trying to do similar work for my project,It would be great if I can have a psuedocode/algorithm/sourcecode.

My id is hrastogi@usc.edu...
looking fwd to ur reply

Blibot said...

Hi, could you send me the source code?
arezkiamine@hotmail.com

Anonymous said...

hi,itz amazing & i need ur help ,please send me the source code.

Anonymous said...

hi,itz amazing & i need ur help ,please send me the source code.

elaaece@gmail.com

Anonymous said...

hey man can i have the code,this is my email
www.thanujarockz@gmail.com
thanks man ,


how can i access my tv card with c#,
if u reply me it will be a great help

Kevin said...

Hey, was looking around found your blog. Would love to see your source code for this color based tracking if at all possible? My email is userkevin41@gmail.com Thanks for your time.

Taboen said...

Looks like a lot of people are interested in the source code for this. Including me! But it seems like you're not sharing it, too bad. I am making something similar right now, I want to experiment with this as input for games, as games programmer that is very interesting both technical and design-wise for me :D
Did you use AVIcap? WIA? Directshow?

Dennis said...

Are you using OpenCV or MATLAB? I have this problem of tracking the moving ball and I did color recognition in my program. I am also doing this motion tracking, but I am always failed to make the tracker follow the tracked ball. If its okay for you, can I see the source code? My e-mail is dhenn0021@gmail.com. Thanks for any response... :)

amarish said...

hi your object tracking is so much amazing.. if you allow me, would you permit me to use the source code if you can please email me at duceamarish@yahoo.com. do you have any idea of real time object recognition? thank you hoping for your reply..

Anonymous said...

hi... you're really amazing man... found your blog very useful.. i'm working on a project related to this one.. so, can u mail me the matlab code for this... it would be really helpful for my project work.. pls mail it to roboprjct@gmail.com... thanks in advance...

Yuvaraj said...

great!!!
could u pllease send the matlab code to yuvaraj89@gmail.com

Thomas said...

hello,
you just did the same I have to do for school and you did it fantastic. Is it possible to sent me the source code you´ve made. It would be great.

mahieu_thomas@hotmail.com

thank you very much

Anonymous said...

hello, congratulations for your blog, Can you send me the source code of this project? siulrede@hotmail.com thank you

Anonymous said...

You are very good programing. Can you send me the code? Thanks.

elrusodaniel@hotmail.com

Anonymous said...

hi it seems u made a great work.
im trying to do a similar work in matlab for a school project. can u send ur matlab codes please.
my email is
can.yucel@ogr.deu.edu.tr

Jan said...

Hi there!
i love your blog, it's so cool!!
xD

btw, can you please kindly send me the source code for this project? i'm so interested on this project...it's amazing!
Thank YOu!!

email: janice_zyi@yahoo.com

thankz a lot! Appreciate it!
=)

Anonymous said...

Hi,
your prog seems to be very good.
could you e-mail me the app you used. Please not the source code cause I'm not very familiar with compiling. I always get error messages when compiling source codes and cannot fix them cause I'm not a programmer (yet).

This piece of software will be used for doing some expiriments.

e-mail
doctorschelleton@hotmail.com

Thanks a lot.
Really great job.

I've also found this. It might give you some ideas.

http://www.gesturetek.com/3ddepth/introduction.php

Hope you'll like it!
Did anybody get the software?
It would be great if someone could tell me if it is possible to extract the X axis and Y axis for use with PPJOY.
Is there a way to capture multi-objects with different colours at the same time?

Nice job!

dexter said...

hi, i'm trying to track an object by color based. and your algorithm looks so fast and accurate!

is it okay if i ask for your sources? please help me, i'm doing my graduation project and i'm experiencing a lot of trouble.

e-mail: jumbo505@gmail.com

solvognen said...

hi :)

Can please you mail me source code?
Thanks.

ozgenile@gmail.com

Anonymous said...

Hello, it is an interesting project. Can u send me the source code please. My email: siulrede@hotmail.com

Anonymous said...

please send me the source code.
it would be of so kind of you.

my id is eyeshoot3r@gmail.com

Airalone said...

Could I see your code ,please?

I want to use its with my project. But I don't understand in this library. If you want to help me , please talk with me in MSN (suppakit@hotmail.com).

Thank You... .

Anonymous said...

Now,i' doing project about "object Tracking" by webcam.please to help me!.i would like some code of program to referance.
send me : toto_engineering@hotmail.com

Anonymous said...

Very nice work. I am interested in working similar to yours. Could you please send me you code at :wanher3@hotmail.com. Thank you.

Bulli said...

hello, am fascinated by your work. Could you please send me the code. Maybe you have even the old code of the form of persecution. My e mail: Bulli1000@aol.com
Greetings from Marcus

Anonymous said...

Hello, it is an interesting project. Can u send me the source code please. My email: wendy.mg17@yahoo.com

Anonymous said...

Great project.

Can you publish source code?

Anonymous said...

hello ashih, im naveen

can you please post the code or, tell us the basic stuff where can we can learn to code these stuff (like books or internets etc), what platform is it VB or MATLAB. please if u hesitate to upload here please do a favour, please mail me at mailto:mutthunaveen@gmail.com

thanks a lot and all the best

akash said...

nice work ashish..
duse myself akash,,i am trying really hard to develope a code,foe this i am reading matlab help files.but i am not getting idea to develope the code.

my email- cease_fire06@yahoo.com

can u send me the code on this email..
or can u send me ur email id..so that i can contact u n learn this tracking stuff

akash said...

nice work ashish..
duse myself akash,,i am trying really hard to develope a code,foe this i am reading matlab help files.but i am not getting idea to develope the code.

my email- cease_fire06@yahoo.com

can u send me the code on this email..
or can u send me ur email id..so that i can contact u n learn this tracking stuff

Anonymous said...

Hi,

I don't know if you ever actually do this, but i would love to experiment with your source code if you feel alright giving it out. I'm super impressed by this and your other posts. I'm a student and wouldn't be doing anything commercial.

Thanks so much!
naklugman@yahoo.com

Anonymous said...

very nice code....
Could you please send me you code at
esfand8@gmail.com
Thank you.

Anonymous said...

very nice code....
Could you please send me you code at
esfand86@gmail.com
Thank you.

Thanh Hòa said...

To make this project , you must know image processing very clearly
Can you explain to me how do you calculate coordinate x,y of object which has been detect
If you can ,Please contact me by email thanhhoa1187@gmail.com

大秀 said...

So Awesome !!
i'm from taiwan,and saw your experiment about
"real-time color object tracking "
can you send me matlab source code,i really want to try make it , and very very thank you.

edison chen

Anonymous said...

heyy.. Great Work!

Can you share the code now? I was looking forward towards that.. Its been months now :)

thanks!

haider_waqas@yahoo.com

Anonymous said...

Hey Ashish!

Great stuff you're working on! I'm currently working on a project that also uses webcam tracking, (I'll tell you all about it if you'd like)

It would be wonderful if you could send the code to onwijzebackup@gmail.com.
One question: have you included the possibility to output the X.Y.Z-values to an external target?
Thanks in advance!

Ahmed said...

please i need the source code
my e mail
ahmed_tesjeel@yahoo.com

NiKHiL said...

Great work...
I have created a red ball tracking program but as soon as any red object comes my programs fails.it detects may circle.Plz send me ur source code on nikpat1988@gmail.com

dhewi_25sep said...

Can you share the code now?
^_^'
i can study that code now...
thanks be for!

dhewi_25sep@yahoo.co.id

Anonymous said...

Hi.

please sent me the source code

my email npeti12@freemail.hu

thanks before.

Anonymous said...

Hi.

please sent me the source code

my email npeti12@freemail.hu

thanks before.

Anonymous said...

Hi.

please sent me the source code

my email npeti12@freemail.hu

thanks before.

Anonymous said...

Hi.

please sent me the source code

my email npeti12@freemail.hu

thanks before.

Anonymous said...

Hi.

please sent me the source code

my email npeti12@freemail.hu

thanks before.

Anonymous said...

good day i was wondering if you can send me the source code in my email i need it for our project in soccer robot pls i hope you reply soon

meyanjianpaolosampang@ymail.com

many thanks

Anonymous said...

hey men!
firstly congrats! I need something like this to integrate it to a delta robot... are you sharing the code? if so please let me know freestylepro@gmail.com, else contact me so we can come to something. Thanks!

PRANJAL BHOWN said...

hey brother..an awesome piece of work yet again!! could you please share the code .. m email id is pranjalbhown@gmail.com .. m trying to develop a different type of mouse using this technology..please help!

Anonymous said...

Good work! Is there any possibility to get your sourcecode? (Color Based Object Tracking )

Thanks.

JK

Dundee.JK@seznam.cz

Bill said...

Ashish, this is great work. Can I get source code? I'm very interested in seeing the implementation details.

supascoopa@live.com

Thanks in advance.

Erkan H. said...

Ashish, this is excellent work. Can I get source code?
enavser@hotmail.com
thanks

pubudu said...

this is awsome man.
can you pls send me the source code.i am working on a school project.
thanx in advance

Divya Bhatia said...

hey...gud work..i m wrking on sign language recognition as my project..and colored object tracking is a part of it.could u plz plz mail me the code for this. has it been implemented in matlab or open CV?my id is: a37divya@yahoo.in

Anonymous said...

Great work, can you please send me the code? My address is daisyroberts10@yahoo.com.

Thanks in advance

Daniel Herrejón Delgado said...

Nice work, can you please send me the source code? My e-mail address is budafayer@hotmail.com

Mouna said...

Hi could you please send me the code to : speech.nitw@gmail.com

Unknown said...

Could you please send comptiled version to andrei.kudryavtsev@gmail.com ?

Anonymous said...

Could you please mail me the code at arjunh.mec@mec.ac.in

arun said...

Hi can I get this source code for my work
Plz send the source code to arunsai4b6 @gmail.com