PDA

View Full Version : Tracking Ball with Camera


guoruiwu1994
02-12-2010, 10:50 AM
Does anyone know any good ways to track the balls with the camera? From reading the forums, I see that a good way is to see where the carpet is missing, and then just assume that's where the ball is. However, we don't know which classes and funtions to use in order to achieve this. If anyone can help us on this that would be great.

DavidGitz
02-12-2010, 11:50 AM
From reading the forums, I see that a good way is to see where the carpet is missing, and then just assume that's where the ball is. However, we don't know which classes and funtions to use in order to achieve this. If anyone can help us on this that would be great.


We were originally going to try this method, but due to other objects on the field like robots and the playing field, and having to deal with elements outside of the playing field that the camera would pick up, we deemed this not to be very practical. Unless of course your camera is pointed down sufficiently enough that these things wouldn't be an issue.

Instead our students implemented a normal circle tracking script tuned to the ball instead, reportedly it can track the ball while its even flying through the air (Not sure of the utility in this capability but this means it will work pretty reliably on the ground). I will upload the NI Vision script here so that other teams can tune it to their own needs.

Greg McKaskle
02-12-2010, 04:24 PM
If they've achieved results that amazing, they must have implemented one of those CSI filters the policemen use on TV all the time. Perhaps they can also zoom in and estimate the air pressure of the ball and determine which team's robot kicked it by using the shadows in the image :) .

The circle tracker will be quite slow, needs sharply defined edges, doesn't like shadows. The carpet technique sill be pretty fast and more resistant to blur. The key is to use some of the particle filters before you get the particle analysis and to look at some of the measurements that indicate how circular the particle is.

Note that this technique and the circle detection both need the camera to point downwards in order to be effective. This is pretty easy to verify simply by moving a ball around in front of the robot and viewing on the dashboard.

Greg McKaskle

guoruiwu1994
02-13-2010, 08:16 AM
detectEllipse seems to be a good one to use, however, I cannot find enough documentation on that, where would I put it, and would I have to declare anything?

ideasrule
02-13-2010, 08:26 AM
detectEllipse seems to be a good one to use, however, I cannot find enough documentation on that, where would I put it, and would I have to declare anything?

I've fiddled with detectEllipse, and you're right, the documentation is lacking. If you open Vision Assistant and open the shape detection function, you'll understand what to put for *most* of the parameters. You can find more documentation in the Java library and in the nivision.h header file.

guoruiwu1994
02-13-2010, 09:47 AM
I tried opening up Vision Assistant on the provided Classmate PC, however, I wouldn't work the error message said that the screen resolution is too low. Also, there is no VGA plug to plug in another monitor. Is there a way to stop the screen resolution check?

guoruiwu1994
02-13-2010, 10:03 AM
We are using Netbeans to program the robot, how would I get this working under Netbeans?

joxphoto
02-17-2010, 12:40 AM
I tried opening up Vision Assistant on the provided Classmate PC, however, I wouldn't work the error message said that the screen resolution is too low. Also, there is no VGA plug to plug in another monitor. Is there a way to stop the screen resolution check?

-----------

You can increase the screen resolution to the maximum (1024 x 768, if I'm not mistaken). The tradeoff is that your "workarea" will be slightly bigger than the screen, thus, "panning" effect will be experienced when going from edge-to-edge of the screen.

If you have another computer to use, I suggest installing the Vision Assistant there, create all your scripts and maybe generate some code, then deploy those to your Classmate.

We've done both methods and both work reliably.