From Wikipedia, the free encyclopedia
TSL is a color space that is based on Tint, Saturation, and Luminance.
The transformation from RGB to TSL is:
S
=
9
5
(
r
′
2
+
g
′
2
)
{\displaystyle S={\sqrt {{\frac {9}{5}}\left(r'^{2}+g'^{2}\right)}}}
T
=
{
1
2
π
arctan
r
′
g
′
+
1
4
,
if
g
′
≠
0
∧
r
′
g
′
>
0
1
2
π
arctan
r
′
g
′
+
3
4
,
if
g
′
≠
0
∧
r
′
g
′
<
0
1
2
,
if
g
′
=
0
{\displaystyle T={\begin{cases}{\frac {1}{2\pi }}\arctan {\frac {r'}{g'}}+{\frac {1}{4}},&{\mbox{if}}~g'\neq 0\land {\frac {r'}{g'}}>0\\{\frac {1}{2\pi }}\arctan {\frac {r'}{g'}}+{\frac {3}{4}},&{\mbox{if}}~g'\neq 0\land {\frac {r'}{g'}}<0\\{\frac {1}{2}},&{\mbox{if}}~g'=0\\\end{cases}}}
L
=
0.299
R
+
0.587
G
+
0.114
B
{\displaystyle L=0.299R+0.587G+0.114B}
where:
r
′
=
r
−
1
3
{\displaystyle r'=r-{\tfrac {1}{3}}}
g
′
=
g
−
1
3
{\displaystyle g'=g-{\tfrac {1}{3}}}
r
=
R
R
+
G
+
B
{\displaystyle r={\tfrac {R}{R+G+B}}}
g
=
G
R
+
G
+
B
{\displaystyle g={\tfrac {G}{R+G+B}}}
An earlier version of the formula for T used the sign of
g
′
{\displaystyle g'}
to determine whether to add
1
4
{\displaystyle {\tfrac {1}{4}}}
or
3
4
{\displaystyle {\tfrac {3}{4}}}
to
1
2
π
{\displaystyle {\tfrac {1}{2\pi }}}
arctan
r
′
g
′
{\displaystyle {\tfrac {r'}{g'}}}
. That formula generates a discontinuity in the calculated T values for
g
′
{\displaystyle g'}
near zero; using the sign of
r
′
g
′
{\displaystyle {\tfrac {r'}{g'}}}
gives a continuous value of
1
2
{\displaystyle {\tfrac {1}{2}}}
for for
g
′
{\displaystyle g'}
near zero.
[ 1]
{{ color-stub }}
Category:Color space