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

Improved readability #40

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ajinkya-kulkarni
Copy link

The updated implementation uses the @ operator for matrix multiplication, uses the illuminant_D65 constant from the colour library for the reference white point, and includes a more detailed function signature.

The updated implementation uses the @ operator for matrix multiplication, uses the `illuminant_D65` constant from the `colour` library for the reference white point, and includes a more detailed function signature.
@andreped andreped self-requested a review April 4, 2023 12:54
_rgb2xyz = np.array([[0.412453, 0.357580, 0.180423],
[0.212671, 0.715160, 0.072169],
[0.019334, 0.119193, 0.950227]])
from colour.models import illuminants
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this project, we wish to use pure numpy, torch, or tensorflow without introducing any new libraries. Hence, using the colour library is not ideal.


# scale by CIE XYZ tristimulus values of the reference white point
arr = xyz.copy()
arr = arr / np.asarray((0.95047, 1., 1.08883), dtype=xyz.dtype)
xyz = xyz / illuminants.illuminant_D65()[np.newaxis, :]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to the beforementioned comment, I would keep the old solution for this transform.

The old copy() can still likely be removed, and the variable renaming is fine.

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

Successfully merging this pull request may close these issues.

None yet

2 participants