Tracking balls in a video and find their specific locations when are leaving a specific point.
10 views (last 30 days)
Show older comments
ZENONAS ZENIOU
on 3 Jul 2016
Commented: ZENONAS ZENIOU
on 11 Jul 2016
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.
0 Comments
Accepted Answer
Image Analyst
on 3 Jul 2016
My attached demo where I track a green Sharpie marker is similar.
7 Comments
Image Analyst
on 7 Jul 2016
Read this, but better yet, just attach your code and video file with the paper clip icon. It should be simple for you to adapt it to find red instead of green - you probably just forgot to change the thresholds. If you don't change those of course, it will continue to find green.
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.
More Answers (3)
ZENONAS ZENIOU
on 8 Jul 2016
7 Comments
Image Analyst
on 9 Jul 2016
Edited: 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?
Image Analyst
on 9 Jul 2016
Try the attached script.

8 Comments
Image Analyst
on 11 Jul 2016
No, because that should work. Perhaps something immediately clears it, like you're displaying another image? I put up outline masks over live video all the time and it's not a problem. Put a breakpoint on that plot call and then execute just that line and see if it puts up the red cross. If it does, then step through to find out what line of code makes it go away.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!