[New-bugs-announce] [issue14323] Normalize math precision in RGB/YIQ conversion

Brian Landers report at bugs.python.org
Thu Mar 15 18:19:37 CET 2012

New submission from Brian Landers <brian at packetslave.com>:

There doesn't seem to be a standard definition for the constants to use when doing the matrix calculations to convert RGB to YIQ or vise versa.  

Also, the current colorsys library uses two digits of precision for RGB-YIQ but six digits for YIQ-RGB.

The attached patch standardizes both functions to use the same constants as Matlab, using the same 3 digits of precision.  This makes a roundtrip of RGB->YIQ->RGB return the original values (for 3 digits of precision).

Also added tests, which brings colorsys.py to 100% coverage.

components: Library (Lib)
files: colorlib.patch
keywords: patch
messages: 155915
nosy: packetslave
priority: normal
severity: normal
status: open
title: Normalize math precision in RGB/YIQ conversion
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file24866/colorlib.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list