# TSL color space

TSL color space is a perceptual color space which defines color as tint (the degree to which a stimulus can be described as similar to or different from another stimuli that are described as red, green, blue, yellow, and white, can be thought of as hue with white added), saturation (the colorfulness of a stimulus relative to its own brightness), and lightness (the brightness of a stimulus relative to a stimulus that appears white in similar viewing conditions). Proposed by Jean-Christophe Terrillon and Shigeru Akamatsu, TSL color space was developed primarily for the purpose of face detection.

## Conversion between RGB and TSL

The conversion from gamma-corrected RGB values to TSL is straightforward:

$T={\begin{cases}{\frac {1}{2\pi }}\arctan {\frac {r'}{g'}}+{\frac {1}{4}},&{\mbox{if}}~g'>0\\{\frac {1}{2\pi }}\arctan {\frac {r'}{g'}}+{\frac {3}{4}},&{\mbox{if}}~g'<0\\0,&{\mbox{if}}~g'=0\\\end{cases}}$ $S={\sqrt {{\frac {9}{5}}\left(r'^{2}+g'^{2}\right)}}$ $L=0.299R+0.587G+0.114B$ where:

$r'=r-{\tfrac {1}{3}}$ $g'=g-{\tfrac {1}{3}}$ $r={\tfrac {R}{R+G+B}}$ $g={\tfrac {G}{R+G+B}}$ Likewise, the reverse transform is as follows:

$R=k\cdot r$ $G=k\cdot g$ $B=k\cdot (1-r-g)$ where:

$r=r'+{\frac {1}{3}}$ $g=g'+{\frac {1}{3}}$ $r'={\begin{cases}\pm {\frac {\sqrt {5}}{3}}S,&{\mbox{if}}~T=0\\x\cdot g',&{\mbox{if}}~T\neq 0\\\end{cases}}$ $g'={\begin{cases}-{\sqrt {\frac {5}{9(x^{2}+1)}}}\cdot S,&{\mbox{if}}~T>{\frac {1}{2}}\\{\sqrt {\frac {5}{9(x^{2}+1)}}}\cdot S,&{\mbox{if}}~T<{\frac {1}{2}}\\0,&{\mbox{if}}~T=0\\\end{cases}}$ $k={\frac {L}{0.185r+0.473g+0.114}}$ $x=-\cot({2\pi \cdot T})$ For T = 0, conversion from TSL to RGB is not unique because the sign of r' is lost in this case (note ±). In practice you can work this around by using signed zero for T and thus preserving the sign of r'.

The advantages of TSL color space lie within the normalization within the RGB-TSL transform. Utilizing normalized r and g allows for chrominance spaces TSL to be more efficient for skin color segmentation. Additionally with this normalization, the sensitivity of the chrominance distributions to the variability of skin color is significantly reduced, allowing for an easier detection of different skin tones.

### Comparison of TSL to other color spaces

Terrillon investigated the efficiency of facial detection for several different color spaces. Testing consisted of using the same algorithm with 10 different color spaces to detect faces in 90 images with 133 faces and 59 subjects - 27 Asian, 31 Caucasian, and 1 African). TSL showed superior performance to the other spaces, with 90.8% correct detection and 84.9% correct rejection. A full comparison can be seen in the table below.

Color Space # of Elements CD (%) CR (%)
TSL 258 90.8 84.9
r-g 328 74.6 80.3
CIE-xy 388 56.6 83.5
CIE-DSH 318 60.9 75.0
HSV 408 55.7 84.7
YIQ 471 47.3 79.8
YES 494 41.6 80.3
CIELUV 418 24.1 79.0
CIELAB 399 38.4 83.6