MATLAB Answers

Tracking balls in a video and find their specific locations when are leaving a specific point.

57 views (last 30 days)
Hi everyone. I need your help. It concerns a project that i need to do. Does anyone knows how i am tracking a balls in a video and find their specific location and time that left from a circle shape? I keep trying find something similar but i couldn't find something. Any help will be very appreciated. Thanks a lot.

Accepted Answer

Image Analyst
Image Analyst on 3 Jul 2016
My attached demo where I track a green Sharpie marker is similar.
  7 Comments
Image Analyst
Image Analyst on 9 Jul 2016
Do you want to know when the centroid of the ball leaves the big circle, or when any part of the perimeter of the ball leaves the big circle?
Anyway, I looked at the video and it looks like my suggestion in one of your 3 other duplicate questions should work. Just use my video reading program, and then simplify it. Like make the background the average of the first 20 frame or so instead an adaptive one from the past few frames. Then subtract the frame from the background and see where the difference is more than some amount. Then find the boundaries and see where any of those points are within a radius of the center of the big circle. Not hard. I'm sure you can do it.

Sign in to comment.

More Answers (3)

ZENONAS ZENIOU
ZENONAS ZENIOU on 7 Jul 2016
Basically is the code that you send me with the green sharpie. So now basically i need to track one ball every time.

ZENONAS ZENIOU
ZENONAS ZENIOU on 8 Jul 2016
I have attached a file with the code. What basically i need to do is to saving the positions of each blob and the connect all the points and represent the path that the blob followed. Also imagine that in a video there is a circular shape where all the balls are moving through. What i need to do basically is to know where the blobs (ball) exiting that circular shape. Thanks a lot
  7 Comments
Image Analyst
Image Analyst on 9 Jul 2016
DO you want to know when the centroid of the ball leaves the big circle, or when any part of the perimeter of the ball leaves the big circle?
When I try to play the file in Windows Media Player it just shuts down immediately. So I can't see this file. Does it work with MATLAB?

Sign in to comment.


Image Analyst
Image Analyst on 9 Jul 2016
Try the attached script.
  8 Comments
ZENONAS ZENIOU
ZENONAS ZENIOU on 11 Jul 2016
The red cross appears. I just want to see the coordinates where the balls exiting the circle. For the time where not balls are in the frames this is shown up: Processed frame 16 of 230 Area of frame 16 = 17. And when the blob appears this is shown: Area of frame 53 = 6986. distance from circle center for frame 53 = 4.550689e+02. What basically i need to do as a final result of this code is to plot a histogram and showing from which site of the circular shape did the balls exited the circular shape. So i thing i need to know the location of the blob when exiting the circle or at least the last position of the ball inside the circle before exiting the circle? Thanks again for your help

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!