Any thoughts or code on the feasibility of using the camera to detect gamepieces?
I've been using the NI Vision assistant, and I came up with two methods so far.

The first one uses the "find geometric shapes" VI to find the circle.
The second one does a color threshold, and then uses the "Find circles" VI.

It seems like the second one should be more robust, but I haven't gotten it to detect the ball yet, because it's not quite a continuous circle. I think the gray stripes wreak havoc with actually trying to represent the ball as a circle.
However, I'm worried that the first method will pick up the goal target as well.

I've uploaded both scripts, and a sample image, so you can try. (It's zipped, because Chief Delphi doesn't allow an .scr file to be uploaded)

Alan Anderson

01-30-2010, 10:26 PM

...I'm worried that the first method will pick up the goal target as well.

What if it does? If you mount your camera at an appropriate height, the balls will all be below horizontal and the targets will be above it.

sloteera

01-30-2010, 10:34 PM

Could you make an combination between Color Location and Find Geometric Shapes to prevent any confusion of the camera between ball and target?

If you consider that the floor is green and ball is white, you'll have a good enviroment to use these two functions.

I tryed it... but I think that I hadn't success because we are use our camera with mirrors associated!!!

daltore

01-30-2010, 10:36 PM

Is this just for the robot to find the balls laying on the ground, or flying through the air? Because if it's through the air, there's no way you can get a good enough data rate on that.

I remember something when they released the system last year about blob detection, would that be a better solution? (Not sure, haven't really done any vision processing before this year) I would think the gray stripes would be discounted in blob detection because overall, the majority of the ball is white.

kamocat

01-30-2010, 11:26 PM

Alan: You're right, a RIO would probably fix that, and make it considerably faster, too.

Sloteera:
Thank you! I forgot that the floor was green this year. I was thinking grey again.
What that means is I can very effectively filter that out by separating the RGB image, thresholding the red and blue, and ANDing that back together. That should also eliminate the problem with the stripes.

Aaron:
I by no means plan to track, or even interact with, balls flying through the air. I was actually intending to locate fairly stationary balls.
I believe what you're referring to is the "size ordered morphology" of last-year's tracking code. It might be my best bet to use that, however, I would have to investigate the reflective properties of the field, as this would would not filter it to just round objects.

I'll upload a test in a bit. I don't have the near-official one right with me, but I figured this picture (http://images.google.com/imgres?imgurl=http://cache3.asset-cache.net/xc/84743020.jpg%3Fv%3D1%26c%3DIWSAsset%26k%3D2%26d%3D B3B7071D257FC039AF847B394673090C76445B22AA16B2E0C7 33DB20556D146B&imgrefurl=http://www.gettyimages.com/detail/84743020/Riser&usg=__LaSJhnycLEbXvMR9_VvOYQh96uQ=&h=337&w=506&sz=47&hl=en&start=25&um=1&tbnid=evydBfiKmbCH0M:&tbnh=87&tbnw=131&prev=/images%3Fq%3Dwhite%2Bsoccer%2Bball%2Bon%2Bgrass%26 ndsp%3D18%26hl%3Den%26sa%3DN%26start%3D18%26um%3D1 ) would do.

EDIT:
I got it done. For simplicity, I just did a color threshold (instead of separating them out just to ignore the green).
Also, I used a "measure particles" VI for analysis, as opposed to the "find circles". I'm assuming that with less than a 1.2 ratio between width and height, and less than 20% holes, it will be a valid gamepiece.

Greg McKaskle

01-31-2010, 11:29 AM

I think you are on the right track. The blob detection, or particle analysis as it is also called, can return a huge number of measurements and is very fast once you have the binary image.

I've played with this a bit, and it is helpful to play with a few discrete things.

First, it is useful to find filters that will clean up the image. In particular, you can probably filter out all small particles. This is often a good first step. Second, the balls punch a pretty good circular hole in the carpet color, but since balls cast shadows they will rarely make a perfectly circular hole. Anyway, it may be necessarily to perform one of the morphology steps like an open or close -- which is built on erode and a dilate cycles. Either play with these in the script or read the concept manual for more detail on when to use them and how they work.

Finally, if you measure terms like the Heywood circularity and perimeter and area. If you lay out balls on the carpet and get some sample images, you can view these measurements to find some factors that are unique to round objects. If you need more info, just ask.

Greg McKaskle

MrForbes

01-31-2010, 11:35 AM

balls are round and glossy, lights shining on the field are very bright, good luck!

Greg McKaskle

01-31-2010, 11:45 AM

balls are round and glossy, lights shining on the field are very bright, good luck!

This does indeed make it difficult to specifically see the balls. Add to that the ball color is not richly saturated day-glow colors, and it is an all new problem.

This is why the approach kamocat was using is a good one to experiment with. It doesn't look for the ball directly, it looks for missing carpet. Carpet is not shiny, and carpet doesn't even move around on the field. Now if only you can characterize the missing carpet as being a robot or a ball or a line or a wall.

Greg McKaskle

nathanww

02-02-2010, 03:29 PM

balls are round and glossy, lights shining on the field are very bright, good luck!

Hmmm...

This could be a detriment, but it could also be a pretty fast-to-process, reliable signature if combined with some basic logic looking at thing like height and size.

byteit101

02-07-2010, 09:47 AM

Does anyone have any photos of balls on the green carpet? also, some in front of the bumps would be nice (red and green)
Its kinda hard to do ball recognition that will work on a field with a dull used off-white ball and regular carpet

whcirobotics

02-07-2010, 09:54 AM

Hi does anyone have a default code for the kicking machanism so we have an idea what to work towards, becasue we are not that experienced. Tnx

Vikesrock

02-07-2010, 09:58 AM

Hi does anyone have a default code for the kicking machanism so we have an idea what to work towards, becasue we are not that experienced. Tnx

Teams are designing all sorts of different kicking mechanisms that are actuated in many different ways.

It is unlikely that another team's code will work for you.

If you need help please start your own thread in the appropriate programming forum here (Labview, C++ or Java) and describe exactly what you are trying to do (make motors move for X seconds, control pneumatics, control servos or whatever else actuates your kicker). Please try to be as specific as possible.

joxphoto

02-17-2010, 12:46 AM

Could you make an combination between Color Location and Find Geometric Shapes to prevent any confusion of the camera between ball and target?

If you consider that the floor is green and ball is white, you'll have a good enviroment to use these two functions.

I tryed it... but I think that I hadn't success because we are use our camera with mirrors associated!!!

--------------

Our team has been successful in identifying a white ball against a green background. I recommend a two-level test (meaning you will have to create 2 scripts in VA): 1- Identify a round object using appropriate steps in VA, 2- another script to identify the appropriate range of color that would be the official ball color for the competition. This methodology would at least increase your chance of finding THE ball, instead of just another round object in the playing field.

byteit101

02-20-2010, 04:49 PM

We have written a ball tracker in VA, but can't seem to get it to work on the robot (C++) It worked once (we were seeing numbers come out) but hasen't since then. also writing an image to file does not work, Is there a way to stream the binary image after particle analysis?
attached is the scr, some sample images, and the C++ code (adapted from 2010VisionDemo, added in exported VA C code)