[issue14323] Normalize math precision in RGB/YIQ conversion

Serhiy Storchaka report at bugs.python.org
Mon Aug 5 10:20:13 CEST 2013


Serhiy Storchaka added the comment:

> Can you add a reference for the coefficients?

I have only link to Wikipedia which refers to Code of Federal Regulations §73.682. This link (http://en.wikipedia.org/wiki/YIQ) already mentioned at the top of the file.

> (You claim about the current rounding is not exactly correct. While .28*g rounds .277 rather than .274, the current .52*g rounds the non-FCC .523 rather than the FCC .5251. So I avoided making the claim in the suggested entry. It is not important.)

A sum of coefficients in this line should be 0 (Q=0 for R=G=B).

Patch updated. I added a What's New entry and update to use of unittest.main(), rewrite rgb_to_yiq() in the form as in Wikipedia (it uses less multiplications) and write coefficients in yiq_to_rgb() with maximal precision (as calculated with Python).

----------
Added file: http://bugs.python.org/file31163/colorsys_yiq_fcc_2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14323>
_______________________________________


More information about the Python-bugs-list mailing list