Author Topic: TSL color space  (Read 200 times)


  • Member
  • ****
  • Posts: 826
  • Assembly is a state of art.
    • RosAsm
TSL color space
« on: April 23, 2017, 08:02:32 AM »
Hi guys, someone have succeeded using the Tint Saturation and Light colorspace for image manipulation ? (It is not the HSL/HLS). I gave a test porting the code from RGBtoTSL and TSLtoRGB, but it seems that the mathematics on the original colorspace are incorrect.

The conversion from RGB to TSL are Ok...but when trying to convert it back (TSL to RGB), the values are utterly wrong.

The math involved are here:

For Light variable it uses for converting RGB to TLS the same data matrix as in YIQ colorspace (L = 0.299*R+0.587*G+0.114*B), which, in fact, the proper values are:
Code: [Select]
L = 0.29889531*Red + 0.58662247*Green +  0.11448223*Blue
The main problem is on the reverse operation. The k factor used to convert back to RGB seems incorrect.
Code: [Select]
k = L / (0.185r+0.473*g+0.114)This values doesn´t seems correct, and, in fact, (if i ported it correctly) the reverse operation simply does not works on this color transformation.

Somebody have ever used it ? or have any idea of the math involved to correctly fix the reverse operation (TSL to RGB) ?

TSL colorspace is supposedly created to better separate the colors of the human skin (it was designed for skin detection), but, in fact, for what i understood of the maths, it most likely separate a better range of colors (similar to Hue) regardless  it is for a specific set of colors for human skin. So, it probably can be used to find any tint of a specific image, isolating it on a similar accuracy as in CieLab, for example. seems to not work on the reverse operation :(  Any ideas how to fix it ?
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites: