TSL color space

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 = \sqrt{\frac{9}{5}\left( r'^2 + g'^2 \right)}

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 \\ \frac{1}{2},                                         & \mbox{if}~g'=0 \\ \end{cases}

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}