Colors.jl icon indicating copy to clipboard operation
Colors.jl copied to clipboard

Source of the YIQ transform matrix

Open kimikage opened this issue 4 years ago • 1 comments

In relation to the issue #453, I have considered whether gamma correction should be considered in the conversion between RGB and YIQ, and my policy is to not apply gamma correction for now. (cf. https://github.com/JuliaGraphics/ColorTypes.jl/pull/250#issuecomment-836290375)

Apart from the gamma correction, there is also a discussion about the coefficients of the transformation matrix. I am going to change the implementation of matrix-based transform regarding #477 (Edit: see also PR #482 ). For the discussion on numerical error, I am looking for a reliable source of the coefficients.

The current coefficients are as follows: https://github.com/JuliaGraphics/Colors.jl/blob/2c285e817208dac66d831db83691558fa44e25cc/src/conversions.jl#L178-L183 https://github.com/JuliaGraphics/Colors.jl/blob/2c285e817208dac66d831db83691558fa44e25cc/src/conversions.jl#L697-L702

I know that these values are often used, but I could not find the origin of the values. In fact, hose values are different from the SMPTE 170M-2004 specification.

These kinds of coefficients are often the subject of editing wars in Wikipedia and they are not very helpful. (It's not as bad as the case of sRGB, though.:cold_sweat:)

Also, the number of significant digits and the rounding direction in clamping are a bit weird. https://github.com/JuliaGraphics/Colors.jl/blob/2c285e817208dac66d831db83691558fa44e25cc/src/conversions.jl#L693-L695

kimikage avatar Jun 02 '21 07:06 kimikage

You would normally go from a gamma-encoded RʹGʹBʹ to YʹIQ and leave the gamma in place.

Use the 601 coefficients for standard definition (720x576 and lower), and 709 for high definition.

Myndex avatar Feb 05 '23 01:02 Myndex