Ask Your Question

Help recognizing color shapes that are bright

asked 2012-11-28 09:45:45 -0500

kyleo gravatar image

updated 2012-11-28 09:47:50 -0500

I'm having a hard time differentiating between two different image blobs for an image that has either a red or green circular light. I've tried tweaking the camera settings (propset). The blobs look completely different to me but the computer is seeing them as nearly identical colors (and in the dim image propset, identical values). What can I tweak or what other technique can I use to help me distinguish them? I'm using a colorDistance after identifying the image, but this won't do me any good at recognizing blobs if the color values are almost the same.

default settings results: green light: color: (232.0, 237.0, 235.0) red light: color: (235.0, 235.0, 235.0)

dim propset: greendim: color = (123.0, 123.0, 123.0) red_dim: color = (123.0, 123.0, 123.0)

I'm really surprised that the dim color set images the color is somehow exactly the same.. really annoying because my eye can clearly see the difference. Should I start looking at converting these images to HSV?

(Sorry can't post links apparently, due to not enough karma)

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2012-11-29 09:55:24 -0500

kscottz gravatar image

Great question!

You may want to take a look at the hueDistance and findBlobs methods. The findBlobsFromPallete method could also help (note that you should update from the github develop branch as this method was recently updated). Another helpful tool is the Color class. The color class has a few methods that can help you switch between rgb colors and hues (although it isn't perfect). With bright enough illumination all colors of light look the same (that is to say white, as they saturate all the sensor channels). The area around the light where it refracts is actually where you are going to pick up the most color difference. You may also want to lower you camera's gain and or turn down the exposure.

My guess is that you may want to turn this into a two step process. First look for the brightest, whitest area in the scene, and then filter it on shape and size. This should give you an estimate of the light location. Once you have that you can look at the average color around that region to see if it skews red or green.

Let us know if you need more help.

edit flag offensive delete link more

answered 2012-11-28 11:20:08 -0500

kyleo gravatar image

I wonder if I would have more success if I did a findBlobs, then identified circles, cropped the image to that location + 10, then determined the meanColor() and matched it to either red or green. Either way I'm not sure how I am going to identify the color of the lights here when the camera is picking them up as mostly white.

edit flag offensive delete link more


I spoke to an expert in the field (from my place of work) he has suggested HSV is a better route to follow and hinted it's known as HS BRIGHTNESS as well as HSV.

dwhyte gravatar imagedwhyte ( 2012-12-07 13:32:28 -0500 )edit

answered 2012-11-28 13:06:20 -0500

dwhyte gravatar image

updated 2012-11-28 13:07:03 -0500


I am looking at something to this, perhaps an array of 'bright colors' and seeing if it is in this array? The problem is that this is very manual, inputting a bunch of colors and particularly painful to work out if the light is changing the color (red under bright light is white, as is yellow). Though, Image.whiteBalance() looks to be a way of helping with this.

Bookmarked with interest :-)

D. Whyte

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-11-28 09:45:45 -0500

Seen: 2,742 times

Last updated: Nov 29 '12