Hello,

 1. you go from RGB to XYZ using the ICC profile of the RGB space you
    are using, which gives you the coeffs of the 3×3 matrix RGB -> XYZ.
    Call that matrix M. Do a matrix dot product [XYZ] = [M] * [RGB]
 2. you go from XYZ to Yxy using x = X / (X + Y + Z) and y = Y / (X + Y + Z)
 3. you subtract the x and y values by those of the white point you are
    using (usually, D50). That's x_D50 = 0.34567 and y_D50 = 0.35850,
    using 2° CIE 1931 observer. So
    x = X / (X + Y + Z) - x_D50 and y = Y / (X + Y + Z) - y_D50,
 4. then, hue = arctan2(y, x), saturation = sqrt(x^2 + y^2)
 5. since it's only to produce a boolean mask, you don't need to bother
    about the back transform. But in case you need :
     1. x = saturation * cos(hue) + x_D50, y = saturation * sin(hue) + y_D50
     2. X = xY / y, Y = Y, Z = (1 - x - y) * Y / y
     3. and then, again, matrix dot product [RGB] = [M^-1] * [XYZ] where
        [M^-1] is the inverse of the matrix M formed with the ICC
        profile coefficients.

Cheers,

Aurélien.

Le 11/04/2020 à 18:23, Harold le Clément a écrit :
> Hello,
>
> Thanks a lot for the feedback.
>
> Agree, the problem would be only when trying to use the saturation for
> parametric masking (as the color picker HSL mode is only used for
> that).
>
> Perhaps a cylindrical HSY could be used, but it depends how the
> saturation is computed (most of the information I could find on the
> Internet suppose that the RGB values are bounded).
>
> Anyway, in the mean time I could just disregard the saturation selector.
>
> Thanks,
>
> Harold
> ___________________________________________________________________________
> darktable developer mailing list
> to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org
>

___________________________________________________________________________
darktable developer mailing list
to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org

Reply via email to