When invoking the various colorspace conversion methods -rgb2xxx, should one first run -srgb2rgb?
That is, should this be run:
gmic myImage.jpg -srgb2rgb -rgb2lab
instead of:
gmic myImage.jpg -rgb2lab
Thanks!
When invoking the various colorspace conversion methods -rgb2xxx, should one first run -srgb2rgb?
That is, should this be run:
gmic myImage.jpg -srgb2rgb -rgb2lab
instead of:
gmic myImage.jpg -rgb2lab
Thanks!
For Lab, yes you should convert sRGB to RGB first, as the transform expect linear RGB as input.
For other colorspaces, Iām not really sure. Iāve implemented the āclassicalā formulas you can see everywhere,
and there often a lack of information about the fact the RGB they use are sRGB or linear RGB.
Iād be interested by a clear answer about that to be honest
Technically speaking, there is nothing like ālinear RGBā, since RGB is not an unique representation⦠what CImg::srgb2rgb() does is to convert āstandardā sRGB to ālinearā sRGB.
Indeed, in the conversion from sRGB to XYZ (which is the first step for converting to Lab), one needs to use linearized sRGB values.
In the case of the conversion to HSV, the gamma encoding of the input RGB values is, as far as I know, not specified. HSV is actually a color representation and not a colorspace, and as such the H, S and V values depend on the colorspace and gamma encoding of the input RGB triplets. The same is true for the HSL and HSI representations.
However, Iām pretty sure that a conversion from sRGB to HSL, HSV or HSI yields different H and S values depending if the input sRGB values are linear or gamma-encoded. In fact, those representations belong to a pre-colormanagement era, and in my opinion the only meaningful and unique polar representation to be used in modern color processing is LCh (i.e. Lab in polar coordinates).
The specifications are more clear in the case of YCbCr (and YāCbCr): YāCbCr must be derived from gamma-encoded RGB values, while YCbCr from linear RGB (as far as I understood).
YāUV definitely requires gamma-encoded values (Wikipedia only discusses YāUV, and I could not find any explicit mention of YUV).
For RGB <-> CMY(K) I have honestly no idea yet.
My 2cts
Thanks, Doctors, for your responses. I was using -srgb2rgb as a
preliminary step in my Gmic flows, given earlier discussion on this site
regarding the ālinearā input expectations of many Gmic operations, but
then while reading some of the Gmic docs I saw several examples of color
conversion operating directly on input jpgāsā¦
Thanks again!