[NetBehaviour] Finding the ball.

marc marc.garrett at furtherfield.org
Tue Feb 21 19:05:48 CET 2006

Finding the ball.

Finding a white ball on a dark surface is child's play. For us.

Computers are a whole other case. Computers can't see form, computers 
can only see color. While this is helpful in situations such as these 
(Note: I'm not a big fan of Flash, but this is the first site ever that 
actually needs Flash and has put it to good use.) most of the time this 
is a disadvantage. For instance, a white bathroom tile half in bright 
sunlight, half in shade looks like two totally separate objects to a 
computer. This can cause serious problems trying to identify a ball, 
because the computer sees the brightly lit side of the ball as one 
object, and the dimly lit side and it's shadow as another. So even a 
white ball on a black background can prove troublesome, as was my case.

In the beginning, on the advice of my professor, Dr. Eric Busvelle, I 
was using a barycenter method, which attaches weights to color 
intensities in order to find objects of interest. This method works 
exceedingly well under controlled circumstances, but exactly as I 
explained above, it runs into problems when dealing with changing light. 
Since the goal of my project is to demonstrate it in various schools and 
to use it as a lab experiment, this was a major stumbling block.

We tried to solve the problem by having as strong and diffuse a light 
source as possible, but we always ran into problems, for instance, as 
the sun advanced across the sky, it shone directly into my lab from 2 to 
4PM, making it impossible for the computer to identify the ball. I 
eventually tried wedging myself into the corner underneath the window 
sill with a black piece of paper on top shielding the table, but it 
still wasn't reliable. Worse, all the noise in the signal would make my 
table shake itself to pieces. Literally.

After expressing my concerns ball_convolution.png  about the barycenter 
process to Eric, he suggested, and coded, a 2D convolution algorithm. 
This worked much, much better, although I still had problems with too 
much light. The solution was finally to move away from the window, as 
far as I could get. Now, the light was sufficiently diffuse that the 
shadows never confused the camera and the ball was always easy to find.


More information about the NetBehaviour mailing list