what is the range of RGB for a specific colour?
Asked Answered
R

2

9

I want to find specific colours in a image generally red green blue orange white black maroon etc. But there are alot of colors in a image. RGB has 256x256x256 range. The problem is I do not have any idea that what range of RGBs Combinations makes any specific colour. For Example, if I want to find black color I can try finding the pixels with RGB range within this [0, 0, 0], [10, 10, 10]. Any idea or trick ?

Rabiah answered 9/8, 2016 at 12:16 Comment(1)
RGB colorspace is just a cube with black in one corner and white diagonally opposite with the primary and secondary colours at the vertices, so you can work out the colour distance between two colours by differencing the red values and squaring it, differencing the two green values and squaring it, differencing the two blue values and squaring it and then adding all those squares together and square rooting to give the radius of sphere of similar colours. Colours further apart than that value are different.Kalimantan
M
3

That's pretty easy. All over the web there are color matching resources that can even come up with a name for your color combinations. You have to decide how close to whatever "color" you want. Traditionally colors are given in hex so 0xFFFFFF is brightest white and 0x000000 is darkest black the first 2 digits are the red, the next 2 the green, and the final two blue. So pure red is 0xFF0000, green is 0x00FF00 and blue is 0x0000FF. Colors within 10 or so of another color are pretty close to that same color, with a bit of variation depending on your eye, the human eyes sensitivity to light and the ability of your display device to reproduce the full range of visible light (called the color gamut). So while 0x000000 is black, 0x101010 is also quite dark, whereas 0x202020 is a very dark grey etc. The colors of course all blend into one another. Hope this helps.

Miranda answered 9/8, 2016 at 12:25 Comment(3)
For Black and White its fine or for Red Blue and Green it will work with + - 10 threshold. If I am thinking about colours like yellow Orange and others like there secondary colours, its a variety of ranges for each colour. For example if I take 1st two primary colours constant and vary 3rd primary colour to find a specific colour. If 3rd is kept constant and vary other two or one teh same colour can also be obtained from that scenario I was thinking, its quite lengthy and difficult to define each colour's RGB range.Rabiah
Pick the orangest color or whatever you like, find its RGB value and go +10 to -10 of that.Miranda
Can you please select this as the answer and upvote it?Miranda
B
1

In this page you can find the differents gradations of primary colors. I suggest you to use this value to set the minimum and the maximum value of red, green, blue which you can use to do what you want. Page link

Bernoulli answered 9/8, 2016 at 12:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.