Closed astraw closed 2 years ago
Hi Andrew,
Thanks for bringing to attention these details.
Here's the clarifications:
ColorSpace::Lrgb
means images are gamma-corrected R'G'B'. The gamma is the one defined in the Rec. 709 specification. The relationship between gamma-corrected (R') and linear (R) is the following:R' = 4.5 * R if R < 0.018,
R' = 1.099 * (R ^ 0.45) - 0.099 otherwise.
It is indeed true that chroma-subsampling is currently done by first scaling the R'G'B' image in gamma-space, then converting to YUV. A more correct approach would convert R'G'B' to linear RGB, scale RGB, convert back to R'G'B', finally convert to YUV. For now, we are sticking with the current approach because is faster than the second one, but an option would be to add a parameter to select the downsampling strategy (apart from gamma issues, current filtering is a mere box one, an area of improvement is to try different filters).
ColorSpace::Lrgb
is thus source of confusion, because it means gamma-corrected, which I agree is counter-intuitive. It should be renamed to ColorSpace::Rgb
like other color conversion libraries do use.Action items for this issue would be:
ColorSpace::Lrgb
to ColorSpace::Rgb
(possibly: keepColorSpace::Lrgb
but deprecate it)Thanks, Fabio
All action items addressed since 0.5.0. Feel free to reopen for other clarifications.
Thanks, Fabio
Very nice, thank you very much. This is very clear.
Hi I'm looking at this crate and see that the docstring for
ColorSpace::Lrgb
says "Gamma-corrected RGB". Can you describe a bit more what this colorspace is? I would guess that the "L" in "Lrgb" might stand for "linear", but then this would, by definition, not be gamma-corrected. If images in the Lrgb colorspace are indeed gamma-corrected and not-linear, what gamma value is expected? And what does "L" mean in that case? Thanks!