Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: XYZ_to_xyY giving 0 #1304

Closed
gul916 opened this issue Oct 21, 2024 · 2 comments
Closed

[BUG]: XYZ_to_xyY giving 0 #1304

gul916 opened this issue Oct 21, 2024 · 2 comments

Comments

@gul916
Copy link

gul916 commented Oct 21, 2024

Description

Hi,
When converting sRGB black value [0, 0, 0] to xyY color model, we obtain [0, 0, 0]. It is rather expected to obtain the D65 white point with Y=0, [0.3127, 0.329, 0]. The opposite operation from black point in xyY to XYZ is working.
Thanks.

Code for Reproduction

import colour
import numpy as np

illum_ccs = colour.CCS_ILLUMINANTS['cie_2_1931']['D65']

XYZ = colour.RGB_to_XYZ([0, 0, 0], 'sRGB', illum_ccs, 'CAT16', True)
xyY = colour.XYZ_to_xyY(XYZ)    # [0., 0., 0.]

xyY_2 = np.append(illum_ccs, 0) # [0.3127, 0.329, 0.]
XYZ_2 = colour.xyY_XYZ(xyY_2)   # [0., 0., 0.]

Exception Message

No response

Environment Information

===============================================================================
*                                                                             *
*   Interpreter :                                                             *
*       python : 3.12.4 | packaged by Anaconda, Inc. | (main, Jun 18 2024,    *
*   15:03:56) [MSC v.1929 64 bit (AMD64)]                                     *
*                                                                             *
*   colour-science.org :                                                      *
*       colour : 0.4.6                                                        *
*                                                                             *
*   Runtime :                                                                 *
*       imageio : 2.36.0                                                      *
*       matplotlib : 3.9.2                                                    *
*       networkx : 3.3                                                        *
*       numpy : 1.26.4                                                        *
*       pandas : 2.2.2                                                        *
*       scipy : 1.13.1                                                        *
*       trimesh : 4.4.9                                                       *
*                                                                             *
===============================================================================
@gul916 gul916 added the Defect label Oct 21, 2024
@KelSolaar KelSolaar added this to the v0.4.7 milestone Oct 21, 2024
@KelSolaar
Copy link
Member

Hello @gul916,

We actually removed this for consistency with other chromaticity coordinates transformations, #1153. We now recommend that users deal with this case on their end by either adding a small epsilon to their values or after the conversion: https://github.com/colour-science/colour-visuals/blob/085585911924072231a6f833365a8f56716a1ea8/colour_visuals/rgb_colourspace.py#L376

Cheers,

Thomas

@gul916
Copy link
Author

gul916 commented Oct 21, 2024

Thank you Thomas for the explanation, I understand. I added an additional line to take this case into account.
Cheers,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants