Image Processing Reference
In-Depth Information
−− WP
P r
P g +
P b
=
+
2 / 3 (P r +
P g +
P b )
+
3 / 9
P r
−− WP
P b
P g +
=
+
1 / 3
(D.9)
where the last reduction is possible since P r +
P g +
P b =
1. Inserting the above
expressions into Eq. D.5 yields
2 / 3
P r
1 / 3
1 / 3
P g
1 / 3
1 / 3
P b
1 / 3
cos 1
θ
=
P r
2 / 3
+ P g + P b
·
1 / 3
cos 1 ( 2 P r / 3
2 / 9 )
+
(
P g / 3
+
1 / 9 )
+
(
P b / 3
+
1 / 9 )
θ
=
9 · 2
P r
P b
P g +
9 · 3 ·
+
1 / 3
cos 1
2 P r
P g
P b
θ
=
6 P r
(D.10)
6 P b
6 P g +
+
2
The final step is now to replace (P r ,P g ,P b ) with (P R ,P G ,P B ) . Recall that P r =
P R /J , P g = P G /J , P b = P B /J , where J = P R + P G + P B . Inserting yields
cos 1
1 /J · ( 2 P R P G P B )
1 /J 2 ( 6 P R +
θ
=
6 P G +
6 P B )
2
cos 1
2 P R P G P B
6 P R +
θ =
6 P G +
6 P B
2 J 2
cos 1 1 / 2
2 P R
P G
P B
θ
=
·
P R +
P G +
P B
P R ·
P G
P R ·
P B
P G ·
P B
cos 1 1 / 2
P B )
(P R P G )(P R P G ) + (P R P B )(P G P B )
(P R
P G )
+
(P R
=
·
θ
(D.11)
Note that the last expression is often applied in order to optimize the conversion
from an implementation point of view. Since Eq. D.5 is only valid in the range
θ
∈[
, 180°
]
the final expression for hue is given below, see Appendix B for details.
θ,
if P G
P B ;
H
=
(D.12)
360°
θ,
otherwise
Search WWH ::




Custom Search