1
\$\begingroup\$

In the YIQ space (I am referring to this wikipedia's article) colors with phases near 0 are close to red.

In the TMS9918 datasheet's table, however, in the expression of colors as A' and phase, blue colors have phase 354. (notice that the two greens have a reasonable phase).

enter image description here

I wondered whether Wikipedia's colors are off with the YIQ space, but they seem to be correct.

In fact let us take the following RGB to YIQ matrix (I found it in this article):

$$ \left[ {\begin{array}{c} Y\\ I\\ Q\\ \end{array} } \right] = \left[ {\begin{array}{ccc} 0.299 & 0.587 & 0.114 \\ 0.596 & -0.275 & -0.321 \\ 0.212 & -0.523 & 0.311 \\ \end{array} } \right] \left[ {\begin{array}{c} R\\ G\\ B\\ \end{array} } \right] $$

Its inverse is:

$$ \left[ {\begin{array}{c} R\\ G\\ B\\ \end{array} } \right] = \left[ {\begin{array}{ccc} 1.0000 & 0.9557 & 0.6199 \\ 1.0000 & -0.2716 & -0.6469 \\ 1.0000 & -1.1082 & 1.7051 \\ \end{array} } \right] \left[ {\begin{array}{c} Y\\ I\\ Q\\ \end{array} } \right] $$

and by plugging in the colors for Y

$$I=A'cos(phase)$$ $$Q=A'sin(phase)$$

that correspond to the datasheet's table dark blue we get the RGB color:

$$\left[ {\begin{array}{ccc} 0.6657 & 0.3393 & 0.0159 \end{array} } \right]$$

or, in 0-255 range:

$$\left[ {\begin{array}{ccc} 170 & 87 & 4 \end{array} } \right]$$

which is a brownish red, and not blue:

Sample of the resulting color

(Color rendered with the RGB Color Wheel).

\$\endgroup\$
  • \$\begingroup\$ Dear Fabio, I've edited your question as best as I could, but please review it as I may have added an error or two. In particular, I didn't understand the part in which the multiplication by Y occur. How should the equations for I and Q be? Thanks! \$\endgroup\$ – Ricardo Jul 13 '14 at 17:22
  • 1
    \$\begingroup\$ thank you very much for your wonderful editing. I modified the sentence \$\endgroup\$ – Fabio Dalla Libera Jul 13 '14 at 18:02
1
\$\begingroup\$

The table you provided in the question shows the phase angle with respect to Q axis. You are calculating with respect to I axis. Hence the difference.

So changing the equations to \$Q=A'cos(phase)\$ and \$ I=A'sin(phase)\$ will produce dark blue, the correct color.

\$\endgroup\$
  • \$\begingroup\$ thank you. I still needed to add 33 degrees to make the yellow (phase 173) be yellow, but rotation of the axis did the trick. \$\endgroup\$ – Fabio Dalla Libera Jul 14 '14 at 2:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.