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

Implement absolute color conversions and chromatic adaptation #139

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

tomcur
Copy link
Member

@tomcur tomcur commented Feb 4, 2025

This is adds absolute color conversions and chromatic adaptation, and is, more or less, a prerequisite for #137.

Conversion methods are added to ColorSpace, ColorSpaceTag, and DynamicColor, that convert between color spaces while keeping the same absolute color (i.e., if that color were to be reproduced, it would be the same physical color, but a perceptually different color under the intended reference white of the color space). These methods are suffixed _absolute. This also adds a chromatically_adapt method for manual chromatic adaptation (useful for, e.g., "white balancing" pictures).

The white points are represented as CIE xy chromaticities. Calculation of chromatic adaptation matrices is const where possible.

A follow-up to this would be to manually implement ColorSpace::{to_linear_srgb_absolute, from_linear_srgb_absolute, convert} for the color spaces we provide. Those can in most cases just lift directly from their non-_absolute counterparts, with the exceptions being XYZ-D50, ACEScg and ACES2065-1. Those methods will get somewhat simpler matrices, as the {D50, ACES}<->D65 adaptation transforms can be dropped.

@tomcur tomcur force-pushed the chromatic-adaptation branch from e6cd13f to bbdfdca Compare February 4, 2025 14:20
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.

1 participant