Tracking tennis balls
Jonathan Morgan from United States  [5 posts]
14 year
I'm trying to track tennis balls in a playing field shown in the attached figures. A robot will move around until the closest tennis ball is located. The closest tennis ball will be picked up by the robot. The robot will continue this process until all tennis balls are picked up. Once all tennis balls are picked, up, the hole in the playing field is located, and the tennis balls are dumped into the hole.

I've looked at a few methods for tennis ball tracking, but I have some concerns with the methods I've already considered. Maybe you could give some suggestions?

The RR program used in the following link works, but the small computer I'm using (a FitPC 2) achieves a processing speed of only 2 fps.


Instead of using shapes to locate the tennis balls, I considered using color, as in the following link. I'm concerned, though, that noise could be an issue, and tennis balls could be misidentified. Perhaps, though, color recongition with some good filtering is my best bet when using such a small computer.


As far as dumping the tennis balls into the hole, perhaps edge finding/line following could be used. If nothing else, I can use a sensor other than RR to perform the dumping operation.

Thanks for your help!

Jonathan Morgan from United States  [5 posts] 14 year
Oops...that first picture is completely unrelated.
Jim from United Kingdom  [12 posts] 14 year
I'd use an RGB filter for yellow, with a high intensity, then a flood fill with a reasonably high merge minimum size to get nice round balls - given how bright the balls are, i'd have thought a filter with no noise could be set up. If there's more than one ball, you'll need a blob filter of some sort to differentiate between them (as far as i know...) but if there's only one, just adding a COG module after flooding should give you a stable cox_x and cog_y. If there's multiple balls a blob filter using color --> brightest ought to be pretty quick to process, although i've no real way of knowing or testing that - it's all quick on this PC. It might be quicker performance wise to use a blob filter instead of the COG module anyway, i wouldn't have thought so though.
The hole ought to findable on a similar principle, using the "darkest" blob filter, without needing to follow the line.
I'm relatively new at this - and don't have a tennis ball to test with - so can't guarantee this is the best approach, but it's where i'd start - in terms of processing i'd expect the colour filter to be much faster than any of the edge detection methods simply because there's less maths involved but whether that's offset by needing to use another method to get X,Y positions i don't know. I also haven't played with the filters much, so that might be a better alternative to flood filling to stabilize the image.
If you can post a video i'll have a look - i'm always after a challenge...
Anonymous 14 year

I concur with Jim. Color would be the quickest way to go. Turns out that green is a better color to track for in your case (this may change with lighting and camera being used). Attached is a sample robofile. How many fps do you get with this? Keep in mind to keep the image as small as possible ... ideally 160x120 will help to increase processing speeds on the fitpc.

Some shots from the actual bot would be helpful too ... I imagine the above images are taken from a handheld cam?


This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index