I have a set of images of the sky, some with clouds, and some without.
Some are clear blue skies, some partly cloudy, some murky with white and grey clouds.
How can I determine that a particular RGB value is, more or less, blue?
Any shade of blue is 'blue' - light blue, dark blue, navy blue, sky blue - these are all blue.
I want to reduce the colors in the image down to 16. Then I want to make a histogram of White, Silver, Grey, Blue and 'everything else'.
How do I know from the RGB value what is a blue or a silver, a white or a grey, or something else?
RGB defines the values of red (the first number), green (the second number), or blue (the third number). The number 0 signifies no representation of the color and 255 signifies the highest possible concentration of the color.
1.1 RGB circles with additive colour mixing Black: RGB(0,0,0) White: RGB(255,255,255)
RGB isn't the best color space to work in for this sort of thing. A color space such as HSV (also known as HSB) provides a more intuitive and descriptive model for a given color.
So, to get what you are after you can use the Hue of a given color. If you are dealing with a System.Drawing.Color
structure you can use the GetHue() method which returns a hue value in degrees. Given a Hue wheel like the following you can define an upper and lower threshold (in degrees) for what Blue values you will accept.
Image processing and Color theory in general are far from trivial subjects. I would suggest that you find the simplest method that meets your requirements. This may be enough for you, or maybe not. If not then perhaps you can narrow the question down a bit for me.
Also realize that you will still need some threshold for the Brightness and Saturation components to ensure that you aren't actually dealing with black, white, or gray.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With