Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Locating and identifying billiard balls

I am developing an application in VB that can capture a frame of video from an overhead camera, find all the billiard balls on the table, and identify them based on color. My problem is accuracy. I can't always find all the balls, and the balls I do find aren't always correctly identified (ones with similar, but not the same colors). I have been using color thresholding to 'remove' the green felt, and then finding the balls in the binary image. Then I would use the hue of the balls to find a match.
I would greatly appreciate any help on this problem.
-Dave
0 Kudos
Message 1 of 2
(3,597 Views)
Dave,

This sounds like a reasonable approach.

Is your lighting good? If you can eliminate a majority of the shadows without getting significant glare off the balls, you will get a pretty good image. I would have at least two separate light sources, one above each end of the table.

Once I had a good image, I would probably take the hue and threshold out the green background, turning everything else white (just like your color thresholding). This should leave a set of white balls on a black background. Your only problem would be if the color of one of the balls is very close to the background. You should be able to do some binary manipulation to make sure all the balls are separated and are the appropriate shape and size.

Once you have all the balls
identified, you might want to classify them as solid, stripe, cue ball, etc. You can extract each ball from the original image and analyze it. Use a histogram on the hue of each ball to determine the dominant color of the ball, excluding black and white unless they are the cue ball or eight ball. You might need to use some kind of fuzzy logic to sort the balls and match them with the most likely candidate.

Bruce
Bruce Ammons
Ammons Engineering
Message 2 of 2
(3,597 Views)