Image Processing Reference
In-Depth Information
V
R
1
H deg =
} +
·
60°
(E.10)
V
min
{
R,G,B
For reasons that will be clear when we look at the next sextant, we rewrite Eq. E.10
in the following way:
1
V
R
H deg =
} +
1
+
1
·
60°
{
V
min
R,G,B
V R
V
min
{ R,G,B }
H deg =
} +
2
·
60°
V
min
{
R,G,B
V
min
{
R,G,B
}
2
B R
H deg =
{ R,G,B } +
·
60°
(E.11)
V
min
For the sextant GW C where G
=
V and B
R we can derive that
2
B R
H deg =
{ R,G,B } +
·
60°
(E.12)
V
min
We can see that Eqs. E.11 and E.12 are the same, which means that we only need
one equation when G
V . The same holds for the last two sextants and the final
equation for hue therefore becomes
=
G B
} ·
60° ,
if V = R and G B ;
V
min
{
R,G,B
2 ·
B R
} +
60° ,
if G = V ;
V
min
{
R,G,B
H deg =
4
(E.13)
R G
} +
·
60° ,
if B
=
V ;
V
min
{
R,G,B
5 ·
R
B
} +
60° ,
if V
=
R and G<B
V
min
{
R,G,B
where H deg ∈[
0 , 360°
[
. Note that hue is sometimes defined as a number in the inter-
val
. This is obtained by dividing by 6 instead of multiplying by 60. Sometimes
the interval
[
0 , 1
[
is used. This is obtained by dividing by 3 and multiplying by π
instead of multiplying by 60.
Note that hue is undefined when no color is present, i.e., R
[
0 , 2 π
[
B . One could
define it to be 0 (or some other value), but a better approach is often to define it as
the hue value of the previous pixel. For a gray-scale image this will not make sense,
but then again, no point in converting a gray-scale image into an HSV image in the
first place! Note also that saturation is undefined in Eq. E.5 when (R
=
G
=
=
G
=
B
=
0 ) .
We therefore make the following definition: S
0 when (R = G = B =
0 ) .
E.2
Conversion from HSV to RGB
The conversion from HSV to RGB depends on in which sextant the point is located.
We can assess that by dividing the hue value by 60 and taking the closets integer
equal to or just below. This directly provides and index K in the range: 0
K
5,
stating in which sextant the point is.
Search WWH ::




Custom Search