<< return to Pixycam.com

White Object Recognition


Recently new to PixyCam for Lego, and we are running great with recognition of solid colored objects (plastic balls).

I was wondering if anyone has PixyCam recognizing white objects. Specifically, looking for recognition of white golf balls on a solid green background (see Robofest game [[http://www.robofest.net/index.php/current-competitions/game]]).

It would be very applicable to Robot Soccer as well, but have not been able to find any solutions using the PixyCam.

Regretfully I did not realize this was a problem before our kids were off to working on adapting PixyCam to their robot.

See RoboGolf table setup for illustration below


A white ball on a (green) solid colored background would seem like a common robot vision theme (I am thinking of Robot Golf, Ping Pong, and Soccer for a few examples).

Just wondering, as my crash-course in PixyCam processing understanding, is that most of the work is done at the individual pixel level, processing RGB input as it comes in.
I understand that color discrimination would be easy to remove black (0x00:00:00 in RGB space) or white (0xFF:FF:FF) and grayscales.

I was wondering if there was something similar to a green screen mask effect, similar to what they do on TV.
Could there be an “expert setting for changing a background color mask.”

Suppose one “expert setting” is to add a background color filter (eg. Exclusive OR – XOR 0x00:FF:00 for green backgrounds) as each pixel was processed from the camera.
In such a case, XOR 0x00:FF:00 of green background would simulate a black background, and XOR 0x00:FF:00 of a white ball would simulate Purple (Red+Blue) ball.
The remainder of PixyCam’s processing could proceed as is, “find purple ball on black background,” by just altering the colorspace from white on green.
The PixyCam performance penalty is one XOR function at the pixel level.

Anyhow just thinking out loud. Hope this might be a feature to add to PixyCam for the robot vision examples listed above. Thanks again for a very cool product!

Hello Shishin,
That looks like a cool competition! I agree that detecting a white ball on a green background would be useful. Unfortunately Pixy can’t make this kind of distinction.

Can you assume the balls are on the green rectangles?

I’ll log this as a feature request. Thanks for the message/feedback!



Don’t know if it helps, but I found an implementation for white object recognition using SimpleCV at the following link

Thank you for registering “white ball recognition” as a feature request.
It would go a long way for robot baseball, golf, soccer, and pingpong. :slight_smile:

Yes, for this competition, white golf balls would be on green paper (aka a “putting green”). All of which sits on a white table on a dark background floor.
The competition is navigation to the “putting green” and correctly position robot to putt the golf ball towards the center hole.
I’m inquiring if competition rules allow us to substitute colored (yellow, orange, or red) golf balls, that would work with the PixyCam. I doubt it though.

Have you tried using a filter such as a translucent red film? Then you would have red balls on a brown background. Just a thought…

This is a tough one because Pixy can detect the green background, but a white object in the middle is going to be essentially ignored. Pixy normally ignores white because it shows up as reflections/glare from light sources. Pixy normally ignores black for similar (opposite) reasons. (sorry)