Measuring distance traveled by an object in a video

25 views (last 30 days)
Hello, I'm relatively new to Matlab but I'm working on a project with a friend who has a decent understanding of it. I have collections of images which I use to make into time lapse video of sea urchins moving around over the course of a day(~1440 frames a day). I would like to measure the urchin's movement during each video. Originally, we though of tracking the urchin based on it's color or shape, but the kelp also present in the pictures sometimes blocks out the urchin. Is there any way I could use Matlab to play the images as a video in which I could pause, plot points when the urchin stops moving, and then have the distance connecting the points calculated? Any help regarding this would be greatly appreciated, and we can also convert the images into video with no problems on Quicktime if that is of any help.
  1 Comment
Sean de Wolski
Sean de Wolski on 12 Aug 2011
Well you could always make a gui that shows you each frame and you click on it - that would be easy enough to program but a pain to use. However, if you show us some sample images we might be able to help you "Dekelp them." Help2Dekelp!

Sign in to comment.

Answers (2)

JJ Smith
JJ Smith on 12 Aug 2011
Here's a sample of a video we made from the images:
The first few seconds are messed up for some reason. I can get a few of the still images too a bit later.
  2 Comments
Sean de Wolski
Sean de Wolski on 12 Aug 2011
for the day light parts could you just get a blank frame of the container and do a subtraction with perhaps a filter for red? At night I don't know how you're going to find them since they're not really visible to the human eye even.
JJ Smith
JJ Smith on 13 Aug 2011
Yeah that video is actually an earlier version where you can't see during night time. Is there any simple way for me to be able to plot a series of points on the video while it plays then have Matlab calculate the distances? I do not necessarily need a code that would track it for me? Also, thank you for the input so far!

Sign in to comment.


Image Analyst
Image Analyst on 15 Aug 2011
I'd make a scroll bar where you can select a particular frame to display. Then I'd have a button that says "Play all as movie" or something similar and when it does that it goes into a loop where you read the images from disk non-stop. The loop would also set the scroll bar value and a title for the image so you can tell what image you're currently on. Title would say something like "Frame #42 of 789". When you do that non-stop look, you can enable, or make visible, a checkbox that say "Stop movie" which the user can click on to break out of the loop. Check its value at the end of the loop and call "break." If you know the location for each frame, like you keep track of it in an array, I'd call "hold off" then call imread(), then call hold on, and finally call plot() to display the locations. That's how I'd do it.
  1 Comment
JJ Smith
JJ Smith on 18 Aug 2011
Would it be possible for you to link me to a code I can use to try this? My Matlab knowledge is rather limited so I wouldn't know where to start in order to make it, but if I had the code I could work with it. Also, I was messing around with the program today, and even if there was a simple way for me to use the ruler tool in the image reader on a video, that would be great.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!