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

Lab and Lch values #49

Closed
sidred opened this issue Feb 13, 2016 · 4 comments
Closed

Lab and Lch values #49

sidred opened this issue Feb 13, 2016 · 4 comments
Milestone

Comments

@sidred
Copy link
Contributor

sidred commented Feb 13, 2016

Continuing discussion from #48.

Lab values are currently scaled, L by 100 and a and b by 128. Even though a and b are unbound, typical ranges are -128 to 128.

By my limited research so far, I have not seen scaled lab values used ( unlike rgb which is usually assumed in the range 0-1 ). For example Conversion formula's, Color Difference formula's and most research papers assume unscaled lab values (I am happy to be corrected on this).

Right now using the lab spaces implies unnecessary scaling when used practically. So I am proposing that the Lab values should be changed to be unscaled. Same for Lch values.

If the decision is to still scale the value, we should provide a new_from_unscaled and into_unscaled function, to get values in and out.

@Ogeon
Copy link
Owner

Ogeon commented Feb 13, 2016

Color Difference formula's and most research papers assume unscaled lab values

I don't know why, but I didn't even think about that. The current scaling turns out to be even worse than I thought. This is probably one of those times when it's better to not be so clever.

@Ogeon Ogeon added this to the 0.3.0 milestone Feb 13, 2016
@sidred
Copy link
Contributor Author

sidred commented Feb 14, 2016

Remember to change the default precision for Lab and Lch when scaling is removed if necessary.
Not relevant, using default precision for the comparisons.

@sidred
Copy link
Contributor Author

sidred commented Feb 21, 2016

With the blending additions, I am not sure whether storing the unscaled or scaled is better. Need to figure out if the blending or conversions are the more common operations.

@Ogeon
Copy link
Owner

Ogeon commented Feb 21, 2016

Blending isn't implemented for Lab and Lch (so far only Rgb, Luma and Color + alpha wrappers). I'm not sure if it makes any sense at all for the other types.

@homu homu closed this as completed in #61 Mar 11, 2016
homu added a commit that referenced this issue Mar 11, 2016
Restore the proper scale of Lab and Lch

This restores the scale of Lab and Lch to be the same as in all of the specifications within reach. That is:

- Lab::l and Lch::l goes from 0 to 100,
- Lab::a and Lab::b goes from -128 to 127,
- Lch::chroma goes from 0 to about 128-181.

Also added additional tests for Lab <-> Lch and Lab<->Xyz conversions. Removed tests for lab and lch from the color mine data as it is not accurate.

This is a breaking change, since everything that uses these values directly will be wrong. Closes #49.
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

No branches or pull requests

2 participants