Image Processing Reference
In-Depth Information
a plane perpendicular to the red axis, which contains the points:
P
,
K
and
Z
.We
now define another plane, denoted
Γ
2
, which contains the points:
R
,
Z
,
W
,
X
R
,
and which is perpendicular to the triangle
R
X
R
O
. This plane contains all possible
values of rgb, and hence also
P
. Since
P
belongs to both planes,
P
must be part
of the line defined by the intersection of the two planes. This line contains
Z
and
is perpendicular to the triangle
R
X
R
O
. That is, if you place your fingertip on
Z
in Fig.
D.3
(a) and lift it vertically, then you are moving along this line and will
eventually reach
P
. Having this in mind we now define the triangle
R
WX
B
, where
X
B
is the middle point of the line spanned by
R
and
G
, see Fig.
D.3
(b). Note that
this figure is also part of Fig.
D.1
(b).
From Fig.
D.3
(b) follows that
=
−−
ZW
⇔
−−
ZW
=
−−
WP
cos
(H )
·
cos
(H )
(D.16)
−−
WP
·
−−
WP
−−
WP
. Realizing that
H
=
From the definition of saturation we have
=
S
−−
WP
60°
−
H
we can express
as
−−−→
−−
WP
=
WX
B
cos
(
60°
(D.17)
−
H)
Inserting Eqs.
D.16
and
D.17
into Eq.
D.15
yields
·
−−−→
1
−−−→
S
WX
B
·
cos
(H )
1
3
P
r
=
·
+
(D.18)
cos
(
60°
−
H)
R
X
R
−−−→
−−−→
WX
B
=
−−−→
−−−→
R
X
R
=
Since
WX
R
and
WX
R
/
1
/
3 we can reduce Eq.
D.18
to
1
·
1
3
cos
(H )
cos
(
60°
S
P
r
=
+
(D.19)
−
H)
After having calculated
P
b
and
P
r
we can find the last coordinate as
P
g
=
−
P
b
−
P
r
. The final step is to convert from rgb to RGB. We know that
P
r
=
P
R
/(P
R
+
P
G
+
P
B
)
,
P
g
=
P
G
/(P
R
+
P
G
+
P
B
)
,
P
b
=
P
B
/(P
R
+
P
G
+
P
B
)
and that
I
=
(P
R
+
P
G
+
P
B
)/
3. From this follows that
P
R
=
1
3
IP
b
.
Substituting into Eqs.
D.3
and
D.19
yields the following expressions which are valid
when 0°
3
IP
r
,
P
G
=
3
IP
g
, and
P
B
=
≤
H
≤
120°:
P
B
=
I
−
I
·
S
(D.20)
1
cos
(H )
cos
(
60°
S
·
P
R
=
I
·
+
(D.21)
−
H)
P
G
=
3
I
−
P
R
−
P
B
(D.22)