ncss-tech / soilDB

soilDB: Simplified Access to National Cooperative Soil Survey Databases
http://ncss-tech.github.io/soilDB/
GNU General Public License v3.0
81 stars 20 forks source link

which color space should we use for mix_and_clean_colors() ? #79

Closed dylanbeaudette closed 4 years ago

dylanbeaudette commented 5 years ago

Related conversation: https://mathematica.stackexchange.com/questions/7483/how-to-calculate-mix-of-4-colors-defined-in-cielab-lab-model/22769#22769

Options:

See related demonstration of mixing.

phytoclast commented 5 years ago

Why not a rough analog of Munsell itself, Hue, Saturation and Value? Not sure how far they'd drift from a linear relationship from Munsell, but it is more intellectually satisfying. Somewhere there's got to be formulas on converting to and from RGB.

https://en.wikipedia.org/wiki/HSL_and_HSV

dylanbeaudette commented 5 years ago

That is an interesting idea. At this point the conversion isn't the hard part--it is picking a system that is reasonable. That said, the precision (lack of) of our screens, ambient lighting, etc. are likely enough to negate any gain from shifting to a different colorspace for mixing.

A more satisfying approach: figure out how to display multiple colors in the sketches according to their observed percentages. A good start: depiction of redox features in soil profile sketches.

brownag commented 5 years ago

Good point that giving a mixed color for a layer that has defined proportions of discrete colors is less than satisfying.

But there is another important avenue for this: I have for a while now wanted to explore the idea of using CIE LAB space mixed colors for a consistent approach to depth-weighted averaging of color data when evaluating if dark surfaces are present in NASIS pedon data.

The linearity of the CIE XYZ may make the actual mixing operations less opaque, if not more accurate. One answer on the SE link you gave above suggested the non-linearity of LAB might not be ideal. The XYZ may lend itself better to developing field heuristics/guides based on munsell chips to more consistently see if the 18cm mixed dark surface occurs.

dylanbeaudette commented 5 years ago

More efficient color conversion: https://github.com/thomasp85/farver

dylanbeaudette commented 5 years ago

Important updates to colorspace package:

http://colorspace.r-forge.r-project.org/articles/color_spaces.html

dylanbeaudette commented 4 years ago

I'm going to call this: CIELAB is the space to mix colors until we have reflectance curves for all soil pigments. CIELAB space is roughly linear in terms of average human perception of color and the results "good enough" for depiction on un-calibrated screens.

Some ideas for later, when we want to try subtractive mixtures of pigments: