I am trying to convert my rgb image to hsv. I am able to find the value and saturation but got into problem while dealing with hue. I searched for the formula for finding the hue value and got one here.
How do you get the hue of a #xxxxxx colour?
But here also the accepted answer has discussed only 3 options.
- R is maximum
- G is maximum
- B is maximum
(So this is not a duplicate question)
But what about other cases such as
R >= G > B or
B >= G > R or
G >= B > R etc
.
Clearly here there is no one value which is the maximum. So for clearing my doubt I searched google and found the following page:
https://en.wikipedia.org/wiki/Hue
Here a table is given that is used for finding the hue value and 6 possible cases are also given. My question is
- what are the values 2,4 or 6 in the formula given in the table and how are they calculated?
Why are only 6 cases possible(as shown in the table)? What about
G > B >= R or G >= B >= R or B >= R > G or B >= R >= G etc.