Image Processing Reference
In-Depth Information
Similar expressions can be derived for the remaining hue values. The only difference
is that the geometry in Fig.
D.3
(b) is only valid when 0°
120°. The hue value
is therefore normalized, denoted
H
n
, to this interval before being applied. The final
conversion from HSI to RGB therefore becomes
≤
H
≤
⎧
⎨
0
,
if 0°
≤
H
≤
120°;
H
n
=
H
−
120°
,
if 120°
<H
≤
240°;
(D.23)
⎩
H
−
240°
,
if 240°
<H <
360°
⎧
⎨
·
1
cos
(
60
°
−
H
n
)
,
S
·
cos
(H
n
)
+
≤
≤
I
if 0°
H
120°;
P
R
=
(D.24)
−
·
≤
I
I
S,
if 120°
<H
240°;
⎩
3
I
−
P
G
−
P
B
,
if 240°
<H <
360°
⎧
⎨
3
I
−
P
R
−
P
B
,
if 0°
≤
H
≤
120°;
·
1
cos
(
60
°
−
H
n
)
,
S
·
cos
(H
n
)
I
+
if 120°
<H
≤
240°;
P
G
=
(D.25)
⎩
I
−
I
·
S,
if 240°
<H <
360°
⎨
I
−
I
·
S,
if 0°
≤
H
≤
120°;
3
I
−
P
R
−
P
G
,
if 120°
<H
≤
240°;
P
B
=
(D.26)
·
1
cos
(
60
°
−
H
n
)
,
⎩
S
·
cos
(H
n
)
+
I
if 240°
<H <
360°