Given the following to convert R, G and B to Y, I and Q (FCC version), how does one convert Y, I and Q back to RGB?
Code:EY′ = 0.30 ER′ + 0.59 EG′ + 0.11 EB′ EI′ = 0.27(EB′  EY′) + 0.74(ER′  EY′) EQ′ = 0.41(EB′  EY′) + 0.48(ER′  EY′)
http://www.gpo.gov/fdsys/pkg/CFR2013title47vol4/pdf/CFR2013title47vol4sec73682.pdf
https://en.wikipedia.org/wiki/YIQ#FCC_version_of_NTSC_standard
Our website is made possible by displaying online advertisements to our visitors.
Please consider supporting us by disabling your ad blocker or buy a VSO converter software :)
Please consider supporting us by disabling your ad blocker or buy a VSO converter software :)
+ Reply to Thread
Results 1 to 18 of 18
Thread

Last edited by chris319; 8th May 2017 at 00:18.


Selur 
Thank you for your reply. I'm not using avisynth and am interested specifically in the FCC version of NTSC:
The FCC version of NTSC standard, which is currently on the books for overtheair analog color TV broadcasting, uses a slightly different matrix
JVRAINES 
Math is my weak spot but I will try to work out the equations. 
It's always good to work on one's math! But you can find the formula in matrix form at https://en.wikipedia.org/wiki/YIQ#Formulas and some implementation code at http://dystopiancode.blogspot.com/2012/06/yiqrgbconversionalgorithms.html

These formulas are just not complete.
There is a conversion (RGB) to (YIQ) and (YIQ) to (RGB). Also there is a conversion E'(RGB) to E'(YIQ). But no E'(YIQ) to E'(RGB); he would have to calculate the inverse matrix on his own. 
Code:
R = y + 0.9563 * i + 0.6210 * q G = y  0.2721 * i  0.6474 * q B = y  1.1070 * i + 1.7046 * q
there is a conversion E'(RGB) to E'(YIQ). But no E'(YIQ) to E'(RGB); he would have to calculate the inverse matrix on his own.Last edited by chris319; 10th May 2017 at 02:18.

Better coverage on Page 20 of this document, which discusses conversion of NTSC in particular.

Last edited by chris319; 17th May 2017 at 07:33.

Here are the inversematrix values for FCC YIQ to RGB courtesy of this handy web site: https://matrix.reshish.com/inverCalculation.php
Code:R = Y + 0.9469 * I + 0.6236 * Q G = Y  0.2748 * I  0.6357 * Q B = Y  1.1 * I + 1.7 * Q
Code:Y = R * #Kr + G * #Kg + B * #Kb I = 0.27 * (BY) + 0.74 * (RY) Q = 0.41 * (BY) + 0.48 * (RY)
Last edited by chris319; 17th May 2017 at 07:39.


The pdf document is on Poynton's site but he didn't write it. One of the authors is from the BBC.
Last edited by chris319; 17th May 2017 at 18:10.

Regarding:
https://en.wikipedia.org/wiki/YIQ#Formulas
http://www.poynton.com/PDFs/coloureq.pdf
If you look at the equations for RGB to YIQ at those two sites you'll see that there are two sign differences in the lower right corner:
[Attachment 41646  Click to enlarge]
So one of them is wrong. After expanding these equations from Poynton's site (I realize the Poynton is not the author, I'm using his name here because the file is at his site and it's easier than typing "Ford/Roberts"):
Code:i = 0.27 * (B  y) + 0.74 * (R  y) q = 0.41 * (B  y) + 0.48 * (R  y)
Code:i = 0.27 * (B  y ) + 0.74 * (R  y ) = 0.27 * (B  (0.299*R + 0.587*G + 0.114*B)) + 0.74 * (R  (0.299*R + 0.587*G + 0.114*B)) = 0.27 * (B  0.299*R  0.587*G  0.114*B ) + 0.74 * (R  0.299*R  0.587*G  0.114*B ) = 0.27 * (  0.299*R  0.587*G + 0.886*B) + 0.74 * ( 0.701*R  0.587*G  0.114*B ) = 0.081*R + 0.158*G  0.239*B + 0.519*R  0.434*G  0.084*B = 0.600*R  0.276*G  0.323*B q = 0.41 * (B  y ) + 0.48 * (R  y ) = 0.41 * (B  (0.299*R + 0.587*G + 0.114*B)) + 0.48 * (R  (0.299*R + 0.587*G + 0.114*B)) = 0.41 * (B  0.299*R  0.587*G  0.114*B) + 0.48 * (R  0.299*R  0.587*G  0.114*B ) = 0.41 * (  0.299*R  0.587*G + 0.886*B) + 0.48 * ( 0.701*R  0.587*G  0.114*B ) =  0.123*R  0.241*G + 0.363*B + 0.336*R  0.282*G  0.055*B = 0.213*R  0.523*G + 0.308*B
When implementing both sets of equations in a program it's clear that Poynton's coefficients are wrong:
Code:RGB (0.5, 0.5, 0.5) > YIQ (0.5, 0.322, 3.11)
Code:YIQ (0.5, 0.322, 3.11) > RGB (0.6156, 0.614, 0.385)
Code:RGB (0.5, 0.5, 0.5) > YIQ (0.5, 0.001, 0.001)
Code:YIQ (0.5, 0.001, 0.001) > RGB (0.500, 0.501, 0.498)
Code:/***************************************************************************/ void YIQ2RGB(double Y, double I, double Q, double *R, double *G, double *B) { double r, g, b; r = Y + 0.956*I + 0.621*Q; g = Y  0.272*I  0.647*Q; b = Y  1.105*I + 1.702*Q; *R = r; *G = g; *B = b; } /***************************************************************************/ void RGB2YIQ(double R, double G, double B, double *Y, double *I, double *Q) { double y, i, q; y = 0.299*R + 0.587*G + 0.114*B; i = 0.600*R  0.276*G  0.323*B; q = 0.213*R  0.523*G + 0.308*B; *Y = y; *I = i; *Q = q; } /***************************************************************************/
Last edited by jagabo; 17th May 2017 at 20:51.

Nice detective work, jagabo.
As you probably know, I'm more interested in the FCC implementation which I have working quite nicely. It has little practical value in the modern era, but I hate to see knowledge of how we did things in the olden days be lost to the ages forever. 
The full FCC conversions are given at the Wikipedia page you originally linked to. The only difference is the use of two digits of precision instead of three in the Y calculation. Ie, 0.30, 0.59 and 0.11 instead of 0.299, 0.587, and 0.114.

Recent addition in the Wikipedia article:
To convert from FCC YIQ to RGB:
ER' = EY' + 0.9469 * EI' + 0.6236 * EQ'
EG' = EY'  0.2748 * EI'  0.6357 * EQ'
EB' = EY'  1.1 * EI' + 1.7 * EQ'
Similar Threads

RGB to YUV to RGB
By chris319 in forum ProgrammingReplies: 70Last Post: 20th Feb 2017, 16:49 
New FCC ruling
By jacatone in forum Latest Video NewsReplies: 13Last Post: 13th Sep 2016, 11:16 
is this YUV or RGB?
By marcorocchini in forum Newbie / General discussionsReplies: 2Last Post: 20th Apr 2014, 10:21 
RGB/B to RGB32
By vin97 in forum Video ConversionReplies: 9Last Post: 6th Jun 2013, 08:29 
YUV 4:2:0 to RGB
By toshyuki in forum ProgrammingReplies: 15Last Post: 8th Oct 2012, 12:12