Thread Subject: Video motion tracking algorithms/code

Subject: Video motion tracking algorithms/code

From: Ben Finio

Date: 8 Apr, 2008 22:08:06

Message: 1 of 15

Does anyone know of good code/algorithm for tracking the
coordinates of multiple points in a video file? I work in a
microrobotics lab where we take lots of high-speed video of
very tiny parts. Most of the parts are dark, navy blue or
black, so we can put spots of retroreflective paint at the
points of interest, then use very bright lets to get an
extremely high-contrast video. The algorithm to track ONE
dot is simple enough, just use the threshold function to
convert the grayscale image to black and white, then use the
regionprops function to find the white areas and their
centroids, and track the centroid of the largest area
(assuming your video isn't perfect and there might be some
small white spots that don't get filtered out by threshold).

So how do you extend that to track multiple dots at once? If
you want to track point A and point B (up to an arbitrary
number of points, within reason), you have to somehow make
sure that you are consistent as to which point is which from
frame to frame; i.e., if you start out with point A on the
left and point B on the right, and in the next frame each
point has moved up a tiny bit, odds are that A is still on
the left and B is still on the right, they didn't both jump
all the way across the screen. Using different colors to
track different dots isn't an option since the high-speed
camera only records in grayscale.

Any ideas, suggestions, or links to useful code if it's
already out there would be appreciated.

Subject: Video motion tracking algorithms/code

From: Ken Campbell

Date: 9 Apr, 2008 04:54:01

Message: 2 of 15

"Ben Finio" <bfinio@fas.harvard.edu> wrote in message
<ftgqc6$7d$1@fred.mathworks.com>...
> Does anyone know of good code/algorithm for tracking the
> coordinates of multiple points in a video file? I work in
a
> microrobotics lab where we take lots of high-speed video
of
> very tiny parts. Most of the parts are dark, navy blue or
> black, so we can put spots of retroreflective paint at the
> points of interest, then use very bright lets to get an
> extremely high-contrast video. The algorithm to track ONE
> dot is simple enough, just use the threshold function to
> convert the grayscale image to black and white, then use
the
> regionprops function to find the white areas and their
> centroids, and track the centroid of the largest area
> (assuming your video isn't perfect and there might be some
> small white spots that don't get filtered out by
threshold).
>
> So how do you extend that to track multiple dots at once?
If
> you want to track point A and point B (up to an arbitrary
> number of points, within reason), you have to somehow make
> sure that you are consistent as to which point is which
from
> frame to frame; i.e., if you start out with point A on the
> left and point B on the right, and in the next frame each
> point has moved up a tiny bit, odds are that A is still on
> the left and B is still on the right, they didn't both
jump
> all the way across the screen. Using different colors to
> track different dots isn't an option since the high-speed
> camera only records in grayscale.
>
> Any ideas, suggestions, or links to useful code if it's
> already out there would be appreciated.

This application was quite specific but you might get some
ideas here

http://jap.physiology.org/cgi/content/full/100/4/1311

Ken

Subject: Video motion tracking algorithms/code

From: MRR

Date: 10 Sep, 2008 12:22:01

Message: 3 of 15

Hi,

I am new in image processing. Right now im searching for developing a program wich was able of tracking a point with a differentiable characteristic (for example, the color), and taking its coordinates.The Kanade-Lucas-Tomasi algorimth could be helpful for what you want to do.

Also, I would like to know if you could help me regarding the tracking of one point, using matlab.

Anyway im researching on it, if i found something I'll let you know.

Kind regards.

Subject: Video motion tracking algorithms/code

From: Rachita Chandra

Date: 6 Oct, 2008 07:21:03

Message: 4 of 15

Hi Ben,
I am working on exactly the same project right now.I have an image with several points of the same color which are displaced and was trying to figure out a code for tracking the coordinates of multiple points before and after the dispalcement using the correspondingimages.Even I have a black and white image and therefore am not sure how to do this as my image has small points so point A in the first image would eb identified as point B in the second image because of the small displacement.Any suggestion/ideas?I considered centroid tracking but that doesnt seem too efficient.
Also would you have any idea on how to figure out if the image has been merely translated or rotated and not displaced?
I'm using matlab for doing all this.So you think that there would be any better language/software for performing these kind of manipulations?

Thanks a ton for any suggestions!

"Ben Finio" <bfinio@fas.harvard.edu> wrote in message <ftgqc6$7d$1@fred.mathworks.com>...
> Does anyone know of good code/algorithm for tracking the
> coordinates of multiple points in a video file? I work in a
> microrobotics lab where we take lots of high-speed video of
> very tiny parts. Most of the parts are dark, navy blue or
> black, so we can put spots of retroreflective paint at the
> points of interest, then use very bright lets to get an
> extremely high-contrast video. The algorithm to track ONE
> dot is simple enough, just use the threshold function to
> convert the grayscale image to black and white, then use the
> regionprops function to find the white areas and their
> centroids, and track the centroid of the largest area
> (assuming your video isn't perfect and there might be some
> small white spots that don't get filtered out by threshold).
>
> So how do you extend that to track multiple dots at once? If
> you want to track point A and point B (up to an arbitrary
> number of points, within reason), you have to somehow make
> sure that you are consistent as to which point is which from
> frame to frame; i.e., if you start out with point A on the
> left and point B on the right, and in the next frame each
> point has moved up a tiny bit, odds are that A is still on
> the left and B is still on the right, they didn't both jump
> all the way across the screen. Using different colors to
> track different dots isn't an option since the high-speed
> camera only records in grayscale.
>
> Any ideas, suggestions, or links to useful code if it's
> already out there would be appreciated.

Subject: Video motion tracking algorithms/code

From: MRR

Date: 6 Oct, 2008 08:29:02

Message: 5 of 15

Hi Rachita,

Look at this link:

http://www.ces.clemson.edu/~stb/klt/

Maybe it can be useful for your purpose, because there are the routines implemented for matlab. Also you can see in youtube how Lucas-Kanade algorithm works.

Tracking points from image to image using the called "optical flow" is exactly what Lucas-Kanade do. Also, I have worked with it using OpenCV. With OpenCV comes an example for viewing with lucas-kanade (using a cam or a video stored).

Hope it helps

MRR

"Rachita Chandra" <rachitach@gmail.com> wrote in message <gcce8v$rcd$1@fred.mathworks.com>...
> Hi Ben,
> I am working on exactly the same project right now.I have an image with several points of the same color which are displaced and was trying to figure out a code for tracking the coordinates of multiple points before and after the dispalcement using the correspondingimages.Even I have a black and white image and therefore am not sure how to do this as my image has small points so point A in the first image would eb identified as point B in the second image because of the small displacement.Any suggestion/ideas?I considered centroid tracking but that doesnt seem too efficient.
> Also would you have any idea on how to figure out if the image has been merely translated or rotated and not displaced?
> I'm using matlab for doing all this.So you think that there would be any better language/software for performing these kind of manipulations?
>
> Thanks a ton for any suggestions!
>
> "Ben Finio" <bfinio@fas.harvard.edu> wrote in message <ftgqc6$7d$1@fred.mathworks.com>...
> > Does anyone know of good code/algorithm for tracking the
> > coordinates of multiple points in a video file? I work in a
> > microrobotics lab where we take lots of high-speed video of
> > very tiny parts. Most of the parts are dark, navy blue or
> > black, so we can put spots of retroreflective paint at the
> > points of interest, then use very bright lets to get an
> > extremely high-contrast video. The algorithm to track ONE
> > dot is simple enough, just use the threshold function to
> > convert the grayscale image to black and white, then use the
> > regionprops function to find the white areas and their
> > centroids, and track the centroid of the largest area
> > (assuming your video isn't perfect and there might be some
> > small white spots that don't get filtered out by threshold).
> >
> > So how do you extend that to track multiple dots at once? If
> > you want to track point A and point B (up to an arbitrary
> > number of points, within reason), you have to somehow make
> > sure that you are consistent as to which point is which from
> > frame to frame; i.e., if you start out with point A on the
> > left and point B on the right, and in the next frame each
> > point has moved up a tiny bit, odds are that A is still on
> > the left and B is still on the right, they didn't both jump
> > all the way across the screen. Using different colors to
> > track different dots isn't an option since the high-speed
> > camera only records in grayscale.
> >
> > Any ideas, suggestions, or links to useful code if it's
> > already out there would be appreciated.

Subject: Video motion tracking algorithms/code

From: Ben Finio

Date: 6 Oct, 2008 13:44:03

Message: 6 of 15

Rachita-

I wound up solving the problem with a rather brute-force method (I am a mechanical engineer, not a programmer, so it wasn't very elegant). I have a relatively small number of points (five) that are all about a centimeter apart. The framerate of our camera is high enough that, from frame to frame, each point only moves around a millimeter. So my algorithm is just to calculate the distance from each point in frame i to every other point in frame i+1, then find the minimum of that distance and assign the corresponding points. Of course, if you have a high number of points or they are very close together, this will fail completely. I know there are proper algorithms to do this that I believe other people have posted links to...sorry I can't be of more help.

Also, this isn't really a problem for me at all anymore because my lab recently invested in a 6-camera, $100,000 high-speed motion tracking system from Vicon that does all of this automatically for you. So if you have a few hundred grand laying around then I'd recommend looking into that...otherwise, doing it for free in Matlab is probably a much more economical solution.

"Rachita Chandra" <rachitach@gmail.com> wrote in message <gcce8v$rcd$1@fred.mathworks.com>...
> Hi Ben,
> I am working on exactly the same project right now.I have an image with several points of the same color which are displaced and was trying to figure out a code for tracking the coordinates of multiple points before and after the dispalcement using the correspondingimages.Even I have a black and white image and therefore am not sure how to do this as my image has small points so point A in the first image would eb identified as point B in the second image because of the small displacement.Any suggestion/ideas?I considered centroid tracking but that doesnt seem too efficient.
> Also would you have any idea on how to figure out if the image has been merely translated or rotated and not displaced?
> I'm using matlab for doing all this.So you think that there would be any better language/software for performing these kind of manipulations?
>
> Thanks a ton for any suggestions!
>
> "Ben Finio" <bfinio@fas.harvard.edu> wrote in message <ftgqc6$7d$1@fred.mathworks.com>...
> > Does anyone know of good code/algorithm for tracking the
> > coordinates of multiple points in a video file? I work in a
> > microrobotics lab where we take lots of high-speed video of
> > very tiny parts. Most of the parts are dark, navy blue or
> > black, so we can put spots of retroreflective paint at the
> > points of interest, then use very bright lets to get an
> > extremely high-contrast video. The algorithm to track ONE
> > dot is simple enough, just use the threshold function to
> > convert the grayscale image to black and white, then use the
> > regionprops function to find the white areas and their
> > centroids, and track the centroid of the largest area
> > (assuming your video isn't perfect and there might be some
> > small white spots that don't get filtered out by threshold).
> >
> > So how do you extend that to track multiple dots at once? If
> > you want to track point A and point B (up to an arbitrary
> > number of points, within reason), you have to somehow make
> > sure that you are consistent as to which point is which from
> > frame to frame; i.e., if you start out with point A on the
> > left and point B on the right, and in the next frame each
> > point has moved up a tiny bit, odds are that A is still on
> > the left and B is still on the right, they didn't both jump
> > all the way across the screen. Using different colors to
> > track different dots isn't an option since the high-speed
> > camera only records in grayscale.
> >
> > Any ideas, suggestions, or links to useful code if it's
> > already out there would be appreciated.

Subject: Video motion tracking algorithms/code

From: Rachita Chandra

Date: 14 Oct, 2008 10:02:02

Message: 7 of 15

Hi Ben
Would you know how to check the translation/rotation using matlab(before you got the fancy camera)...I mean how did u decide which pixel to compare the next with, or did you take the area of the body as a whole while comparing two objexts? Was it a clear cut picture or did youhave to threshold the noise out.For instance for a simplistic image on paint in which I have a red ball in the 1st pic and the same ball translated in the 2nd pic.How did your matlab code detect the translation given these two images? Did youwrite a C code or just an ordinary function?
Also for the rotation, did you do a 360 degree check to detect any form of rotation
Thanks for any suggestions on the MATLAB coding.
Regards,
Rachita

Subject: Video motion tracking algorithms/code

From: Rachita Chandra

Date: 14 Oct, 2008 11:27:02

Message: 8 of 15

Hi MRR
Thanks so much for the link,It was useful...I am exploring linking the C code of lucas kanade with matlab somehow cos Im not used to OpenCV...any idea on the matlab subrooutines that were used?



"MRR " <mario_ruz@hotmail.com> wrote in message <gcci8e$smr$1@fred.mathworks.com>...
> Hi Rachita,
>
> Look at this link:
>
> http://www.ces.clemson.edu/~stb/klt/
>
> Maybe it can be useful for your purpose, because there are the routines implemented for matlab. Also you can see in youtube how Lucas-Kanade algorithm works.
>
> Tracking points from image to image using the called "optical flow" is exactly what Lucas-Kanade do. Also, I have worked with it using OpenCV. With OpenCV comes an example for viewing with lucas-kanade (using a cam or a video stored).
>
> Hope it helps
>
> MRR
>
> "Rachita Chandra" <rachitach@gmail.com> wrote in message <gcce8v$rcd$1@fred.mathworks.com>...
> > Hi Ben,
> > I am working on exactly the same project right now.I have an image with several points of the same color which are displaced and was trying to figure out a code for tracking the coordinates of multiple points before and after the dispalcement using the correspondingimages.Even I have a black and white image and therefore am not sure how to do this as my image has small points so point A in the first image would eb identified as point B in the second image because of the small displacement.Any suggestion/ideas?I considered centroid tracking but that doesnt seem too efficient.
> > Also would you have any idea on how to figure out if the image has been merely translated or rotated and not displaced?
> > I'm using matlab for doing all this.So you think that there would be any better language/software for performing these kind of manipulations?
> >
> > Thanks a ton for any suggestions!
> >
> > "Ben Finio" <bfinio@fas.harvard.edu> wrote in message <ftgqc6$7d$1@fred.mathworks.com>...
> > > Does anyone know of good code/algorithm for tracking the
> > > coordinates of multiple points in a video file? I work in a
> > > microrobotics lab where we take lots of high-speed video of
> > > very tiny parts. Most of the parts are dark, navy blue or
> > > black, so we can put spots of retroreflective paint at the
> > > points of interest, then use very bright lets to get an
> > > extremely high-contrast video. The algorithm to track ONE
> > > dot is simple enough, just use the threshold function to
> > > convert the grayscale image to black and white, then use the
> > > regionprops function to find the white areas and their
> > > centroids, and track the centroid of the largest area
> > > (assuming your video isn't perfect and there might be some
> > > small white spots that don't get filtered out by threshold).
> > >
> > > So how do you extend that to track multiple dots at once? If
> > > you want to track point A and point B (up to an arbitrary
> > > number of points, within reason), you have to somehow make
> > > sure that you are consistent as to which point is which from
> > > frame to frame; i.e., if you start out with point A on the
> > > left and point B on the right, and in the next frame each
> > > point has moved up a tiny bit, odds are that A is still on
> > > the left and B is still on the right, they didn't both jump
> > > all the way across the screen. Using different colors to
> > > track different dots isn't an option since the high-speed
> > > camera only records in grayscale.
> > >
> > > Any ideas, suggestions, or links to useful code if it's
> > > already out there would be appreciated.

Subject: Video motion tracking algorithms/code

From: Ben Finio

Date: 14 Oct, 2008 21:50:18

Message: 9 of 15

Rachita-

I have a grayscale video image, so first I have to convert that to a binary black and white image, which you can do with the thresh command. You then have to break up the image into foreground and background objects using the bwlabel command:

new_image = bwlabel(old_image,8);

Then I have a bunch of white blobs, each one with its own identifying number in Matlab, on a black background. You use the regionprops command to automatically get the areas and centroids of those blobs:

stuff = regionprops(image_name,'Area','Centroid');

Area will give you the area of each blob in pixels, and Centroid will give you the (x,y) location of the center of each blob, also in pixels. You can deal with noise by finding only the LARGEST blobs based on Area - assuming the points you actually want to track are going to be consistently larger than any unwanted noisy points.

I am not totally clear as to what you're asking about rotation. I have a physical shape (I'm tracking a wing) and I apply the white markers at known locations on the wing. So, if I know the orientation of the camera, I can extract the 3D position of the wing just using a 2D image simply by using geometry/trigonometry.

"Rachita Chandra" <rachitach@gmail.com> wrote in message <gd1qmq$nv2$1@fred.mathworks.com>...
> Hi Ben
> Would you know how to check the translation/rotation using matlab(before you got the fancy camera)...I mean how did u decide which pixel to compare the next with, or did you take the area of the body as a whole while comparing two objexts? Was it a clear cut picture or did youhave to threshold the noise out.For instance for a simplistic image on paint in which I have a red ball in the 1st pic and the same ball translated in the 2nd pic.How did your matlab code detect the translation given these two images? Did youwrite a C code or just an ordinary function?
> Also for the rotation, did you do a 360 degree check to detect any form of rotation
> Thanks for any suggestions on the MATLAB coding.
> Regards,
> Rachita

Subject: Video motion tracking algorithms/code

From: MRR

Date: 14 Oct, 2008 22:48:01

Message: 10 of 15

Hi Rachita,

Im sorry, i used lucas-kanade with Opencv (you have an example in the own libraries). Anyway, in the link i put before i remember it was a guide for the matlab subroutines.

Good luck !!

"Rachita Chandra" <rachitach@gmail.com> wrote in message <gd1vm6$7lt$1@fred.mathworks.com>...
> Hi MRR
> Thanks so much for the link,It was useful...I am exploring linking the C code of lucas kanade with matlab somehow cos Im not used to OpenCV...any idea on the matlab subrooutines that were used?
>
>
>
> "MRR " <mario_ruz@hotmail.com> wrote in message <gcci8e$smr$1@fred.mathworks.com>...
> > Hi Rachita,
> >
> > Look at this link:
> >
> > http://www.ces.clemson.edu/~stb/klt/
> >
> > Maybe it can be useful for your purpose, because there are the routines implemented for matlab. Also you can see in youtube how Lucas-Kanade algorithm works.
> >
> > Tracking points from image to image using the called "optical flow" is exactly what Lucas-Kanade do. Also, I have worked with it using OpenCV. With OpenCV comes an example for viewing with lucas-kanade (using a cam or a video stored).
> >
> > Hope it helps
> >
> > MRR
> >
> > "Rachita Chandra" <rachitach@gmail.com> wrote in message <gcce8v$rcd$1@fred.mathworks.com>...
> > > Hi Ben,
> > > I am working on exactly the same project right now.I have an image with several points of the same color which are displaced and was trying to figure out a code for tracking the coordinates of multiple points before and after the dispalcement using the correspondingimages.Even I have a black and white image and therefore am not sure how to do this as my image has small points so point A in the first image would eb identified as point B in the second image because of the small displacement.Any suggestion/ideas?I considered centroid tracking but that doesnt seem too efficient.
> > > Also would you have any idea on how to figure out if the image has been merely translated or rotated and not displaced?
> > > I'm using matlab for doing all this.So you think that there would be any better language/software for performing these kind of manipulations?
> > >
> > > Thanks a ton for any suggestions!
> > >
> > > "Ben Finio" <bfinio@fas.harvard.edu> wrote in message <ftgqc6$7d$1@fred.mathworks.com>...
> > > > Does anyone know of good code/algorithm for tracking the
> > > > coordinates of multiple points in a video file? I work in a
> > > > microrobotics lab where we take lots of high-speed video of
> > > > very tiny parts. Most of the parts are dark, navy blue or
> > > > black, so we can put spots of retroreflective paint at the
> > > > points of interest, then use very bright lets to get an
> > > > extremely high-contrast video. The algorithm to track ONE
> > > > dot is simple enough, just use the threshold function to
> > > > convert the grayscale image to black and white, then use the
> > > > regionprops function to find the white areas and their
> > > > centroids, and track the centroid of the largest area
> > > > (assuming your video isn't perfect and there might be some
> > > > small white spots that don't get filtered out by threshold).
> > > >
> > > > So how do you extend that to track multiple dots at once? If
> > > > you want to track point A and point B (up to an arbitrary
> > > > number of points, within reason), you have to somehow make
> > > > sure that you are consistent as to which point is which from
> > > > frame to frame; i.e., if you start out with point A on the
> > > > left and point B on the right, and in the next frame each
> > > > point has moved up a tiny bit, odds are that A is still on
> > > > the left and B is still on the right, they didn't both jump
> > > > all the way across the screen. Using different colors to
> > > > track different dots isn't an option since the high-speed
> > > > camera only records in grayscale.
> > > >
> > > > Any ideas, suggestions, or links to useful code if it's
> > > > already out there would be appreciated.

Subject: Video motion tracking algorithms/code

From: Rachita Chandra

Date: 31 Oct, 2008 09:54:01

Message: 11 of 15

Did your code/algorithm end up working? I mean did it succeed in detecting the blobs and tracking them successfully and returning the location before and after?


"Ben Finio" <bfinio@fas.harvard.edu> wrote in message <gd346q$6gv$1@fred.mathworks.com>...
> Rachita-
>
> I have a grayscale video image, so first I have to convert that to a binary black and white image, which you can do with the thresh command. You then have to break up the image into foreground and background objects using the bwlabel command:
>
> new_image = bwlabel(old_image,8);
>
> Then I have a bunch of white blobs, each one with its own identifying number in Matlab, on a black background. You use the regionprops command to automatically get the areas and centroids of those blobs:
>
> stuff = regionprops(image_name,'Area','Centroid');
>
> Area will give you the area of each blob in pixels, and Centroid will give you the (x,y) location of the center of each blob, also in pixels. You can deal with noise by finding only the LARGEST blobs based on Area - assuming the points you actually want to track are going to be consistently larger than any unwanted noisy points.
>
> I am not totally clear as to what you're asking about rotation. I have a physical shape (I'm tracking a wing) and I apply the white markers at known locations on the wing. So, if I know the orientation of the camera, I can extract the 3D position of the wing just using a 2D image simply by using geometry/trigonometry.
>
> "Rachita Chandra" <rachitach@gmail.com> wrote in message <gd1qmq$nv2$1@fred.mathworks.com>...
> > Hi Ben
> > Would you know how to check the translation/rotation using matlab(before you got the fancy camera)...I mean how did u decide which pixel to compare the next with, or did you take the area of the body as a whole while comparing two objexts? Was it a clear cut picture or did youhave to threshold the noise out.For instance for a simplistic image on paint in which I have a red ball in the 1st pic and the same ball translated in the 2nd pic.How did your matlab code detect the translation given these two images? Did youwrite a C code or just an ordinary function?
> > Also for the rotation, did you do a 360 degree check to detect any form of rotation
> > Thanks for any suggestions on the MATLAB coding.
> > Regards,
> > Rachita

Subject: Video motion tracking algorithms/code

From: Oussama TAHAN

Date: 17 Dec, 2008 18:32:03

Message: 12 of 15

Good morning,

Do you know where i can find a free Matlab source code for the Lucas Kanade feature tracking algorithm ??

Thank you for your help...

Subject: Video motion tracking algorithms/code

From: Maja Stoevhase

Date: 9 Jan, 2009 20:28:02

Message: 13 of 15

hey Ben,
You mentioned that tracking one point is easy enough, so I thought maybe you could help me out. I just started with my thesis in mechanical engineering but I am terrible with matlab. I took some videos of my experiments and have to track a point so that I can get the distance and thus calculate the velocity of my object.
First of all, can I just draw a big black dot on my object and then make matlab follow that dot? And how do I do all that .. treshold, regionprops.. in my head it all sounds like gibberish. how do I tell it to calculate the distance? I am obviously completely clueless, so I hope you can help me out or give me some idea for a good code...
thank you!
Maja


> The algorithm to track ONE
> dot is simple enough, just use the threshold function to
> convert the grayscale image to black and white, then use the
> regionprops function to find the white areas and their
> centroids, and track the centroid of the largest area
> (assuming your video isn't perfect and there might be some
> small white spots that don't get filtered out by threshold).
>

Subject: Video motion tracking algorithms/code

From: Ben Finio

Date: 9 Jan, 2009 21:55:04

Message: 14 of 15

Maja-

First off, don't be discouraged. I'm also a mechanical engineer, and I got most of this code from a CS guy in my lab when I first got here, and it made absolutely no sense. Working through the code line-by-line and understanding what it does, looking at the help-files for the commands as necessary.

I can probably help you out, but first I need to know a little more about your video - is it being shot in black and white? What is the object you are tracking, and is it in high contrast with the background? i.e. is it a shiny white object on a dark background or vice versa?

"Maja Stoevhase" <hiyamaja@hotmail.com> wrote in message <gk8c0i$si$1@fred.mathworks.com>...
> hey Ben,
> You mentioned that tracking one point is easy enough, so I thought maybe you could help me out. I just started with my thesis in mechanical engineering but I am terrible with matlab. I took some videos of my experiments and have to track a point so that I can get the distance and thus calculate the velocity of my object.
> First of all, can I just draw a big black dot on my object and then make matlab follow that dot? And how do I do all that .. treshold, regionprops.. in my head it all sounds like gibberish. how do I tell it to calculate the distance? I am obviously completely clueless, so I hope you can help me out or give me some idea for a good code...
> thank you!
> Maja
>
>
> > The algorithm to track ONE
> > dot is simple enough, just use the threshold function to
> > convert the grayscale image to black and white, then use the
> > regionprops function to find the white areas and their
> > centroids, and track the centroid of the largest area
> > (assuming your video isn't perfect and there might be some
> > small white spots that don't get filtered out by threshold).
> >

Subject: Video motion tracking algorithms/code

From: Maja Stoevhase

Date: 12 Jan, 2009 05:29:02

Message: 15 of 15

hey Ben!
thank you so much for the help. Sorry I didn't reply sooner. I was waiting for a message in my inbox but never got one. And thank you for the encouragement! Hopefully I will figure it out!
We have two swimmers in a non-Newtonian fluid and we want to test whether they move forward and up and down or whether they are stuck in one spot as they are in a Newtonian Fluid. The thing is that we have one time this rotor I will just call it now that turns in one of the swimmer. This movement causes our swimmer to move forward. It is hard to describe. Do you think I could possibly send you a video that we have already shot so that it makes more sense? Because the rotor turns which causes the swimmer to move forward in a zic zac kind of way. We want to get the distance of the forward movement of the swimmer and then calculate with that the velocity that it moves forward with.
The video will be in color, but we can just draw a big black dot on our swimmer. :) And the background will be white.
 So darker object, lighter background.
I hope any of that made sense to you now!?
Thank you again for helping me with this! I am glad I am not the only matlab struggling engineer! :)

~Maja

"Ben Finio" <bfinio@fas.harvard.edu> wrote in message <gk8h3o$3e9$1@fred.mathworks.com>...
> Maja-
>
> First off, don't be discouraged. I'm also a mechanical engineer, and I got most of this code from a CS guy in my lab when I first got here, and it made absolutely no sense. Working through the code line-by-line and understanding what it does, looking at the help-files for the commands as necessary.
>
> I can probably help you out, but first I need to know a little more about your video - is it being shot in black and white? What is the object you are tracking, and is it in high contrast with the background? i.e. is it a shiny white object on a dark background or vice versa?
>
> "Maja Stoevhase" <hiyamaja@hotmail.com> wrote in message <gk8c0i$si$1@fred.mathworks.com>...
> > hey Ben,
> > You mentioned that tracking one point is easy enough, so I thought maybe you could help me out. I just started with my thesis in mechanical engineering but I am terrible with matlab. I took some videos of my experiments and have to track a point so that I can get the distance and thus calculate the velocity of my object.
> > First of all, can I just draw a big black dot on my object and then make matlab follow that dot? And how do I do all that .. treshold, regionprops.. in my head it all sounds like gibberish. how do I tell it to calculate the distance? I am obviously completely clueless, so I hope you can help me out or give me some idea for a good code...
> > thank you!
> > Maja
> >
> >
> > > The algorithm to track ONE
> > > dot is simple enough, just use the threshold function to
> > > convert the grayscale image to black and white, then use the
> > > regionprops function to find the white areas and their
> > > centroids, and track the centroid of the largest area
> > > (assuming your video isn't perfect and there might be some
> > > small white spots that don't get filtered out by threshold).
> > >

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
tracking point Angela Santin 2 Dec, 2011 21:45:00
tracking point Lin 22 Sep, 2011 09:51:05
motion tracking ADA 4 Jul, 2011 02:20:15
tracking point ahmad 3 Jul, 2011 04:02:48
motion tracking ahmad 3 Jul, 2011 04:01:05
motion tracking Bala Subramanian 29 Apr, 2011 07:23:08
motion tracking Praveen 7 Jan, 2010 06:34:57
image processing leandro ribeiro 20 Jan, 2009 16:48:39
tracking point leandro ribeiro 20 Jan, 2009 16:47:24
lucaskanade MRR 6 Oct, 2008 04:30:24
tracking point MRR 10 Sep, 2008 08:25:06
image processing MRR 10 Sep, 2008 08:25:06
high speed video Ben Finio 8 Apr, 2008 18:10:14
motion tracking Ben Finio 8 Apr, 2008 18:10:14
video analysis Ben Finio 8 Apr, 2008 18:10:13
rssFeed for this Thread

Contact us at files@mathworks.com