开发者

Color Theory: How to convert Munsell HVC to RGB/HSB/HSL

开发者 https://www.devze.com 2023-01-13 21:05 出处:网络
I\'m looking at at document that describes the standard colors used in dentistry to describe the color of a tooth. They quote hue, value, chroma values, and indicate they are from the 1905 Munsell des

I'm looking at at document that describes the standard colors used in dentistry to describe the color of a tooth. They quote hue, value, chroma values, and indicate they are from the 1905 Munsell description of color:

The system of colour notation developed by A. H. Munsell in 1905 identifies colour in terms of three attributes: HUE, VALUE (Brightness) and CHROMA (saturation) [15]

HUE (H): Munsell defined hue as the quality by which we distinguish one colour from another. He selected five principle colours: red, yellow, green, blue, and purple; and five intermediate colours: yellow-red, green-yellow, blue-green, purple-blue, and red-purple. These were placed around a colour circle at equal points and the colours in between these points are a mixture of the two, in favour of the nearer point/colour (see Fig 1.).

Color Theory: How to convert Munsell HVC to RGB/HSB/HSL

VALUE (V): This notation indicates the lightness or darkness of a colour in relation to a neutral grey scale, which extends from absolute black (value symbol 0) to absolute white (value symbol 10). This is essentially how ‘bright’ the colour is.

CHROMA (C): This indicates the degree of divergence of a given hue from a neutral grey o开发者_StackOverflow中文版f the same value. The scale of chroma extends from 0 for a neutral grey to 10, 12, 14 or farther, depending upon the strength (saturation) of the sample to be evaluated.

There are various systems for categorising colour, the Vita system is most commonly used in Dentistry. This uses the letters A, B, C and D to notate the hue (colour) of the tooth. The chroma and value are both indicated by a value from 1 to 4. A1 being lighter than A4, but A4 being more saturated than A1. If placed in order of value, i.e. brightness, the order from brightest to darkest would be:

A1, B1, B2, A2, A3, D2, C1, B3, D3, D4, A3.5, B4, C2, A4, C3, C4

The exact values of Hue, Value and Chroma for each of the shades is shown below (16)

Color Theory: How to convert Munsell HVC to RGB/HSB/HSL

So my question is, can anyone convert Munsell HVC into RGB, HSB or HSL?

Hue    Value (Brightness) Chroma(Saturation)
===    ================== ==================
4.5    7.80               1.7
2.4    7.45               2.6
1.3    7.40               2.9
1.6    7.05               3.2
1.6    6.70               3.1
5.1    7.75               1.6
4.3    7.50               2.2
2.3    7.25               3.2
2.4    7.00               3.2
4.3    7.30               1.6
2.8    6.90               2.3
2.6    6.70               2.3
1.6    6.30               2.9
3.0    7.35               1.8
1.8    7.10               2.3
3.7    7.05               2.4

They say that Value(Brightness) varies from 0..10, which is fine. So i take 7.05 to mean 70.5%.

But what is Hue measured in? i'm used to hue being measured in degrees (0..360). But the values i see would all be red - when they should be more yellow, or brown.

Finally, it says that Choma/Saturation can range from 0..10 ...or even higher - which makes it sound like an arbitrary scale.

So can anyone convert Munsell HVC to HSB or HSL, or better yet, RGB?


It is rather involved. The short answer is, converting Munsell codes into RGB involves interpolation of empirical data in 3D that is highly non-linear. The only data set that is publicly available was collected in the 1930's. Free or inexpensive programs that I have found on the net have proved to be flawed. I wrote my own. But I am jumping ahead. Let's start with the basics.

Munsell codes are different in kind than those other codes, xyY, Lab, and RGB. Munsell notation describes the color of an object - what people experience when they view the object. (Isaac Newton was the first to realize that color is in the eye of the beholder.) Munsell conducted extensive experiments with human subjects and ingenious devices.

The other codes, i.e. xyY, Lab*, and RGB, describe light that has bounced off an object and passed through a convolultion with a rather simple mathematical model of a human eye. Some google-terms are "illuminant," "tri-stimulus," and "CIE standard observer."

Munsell describes the colors of objects as they are perceived under a wide variety of illuminants. Another google-term is "chromatic adaptation." Chromatic adaptation in the brain is automatic if the lighting is not too weird. It is really quite remarkable. Take a piece of typing paper outside under a blue sky. The paper looks white. Take it indoors and look at it under incandescent (yellowish) lights. It still looks white! Munsell tapped into that astonishing processing power empirically. Munsell codes also preserve perceived hue at different chromas. A sky-blue and a powder-blue that Munsell assigns the same hue notation, e.g. 5RP, will appear to the typical human with normal eyesight to be the same hue. More on that in the footnote.

CIE xyY, Lab*, and RGB mean nothing unless an illuminant is specified. Chromatic adaptation for illuminants in the mathematical model is computationally difficult. (Rough but simple approximations can be done using the "Bradford matrices.") The RGB that we use is by default "sRGB," which specifies an illuminant called D65. D65 is something like a cloudless day at noon. The Lab numbers listed by the OP are probably relative to D50, which is more like afternoon or morning light. The xyY numbers might be relative to D50, or they might be relative to an old standard called C. I am not going to check. C was the light from a standard lighting fixture that was relatively inexpensive to build in the 1930's. It is obsolete. But C plays a key role in the answer to the question.

In the 1930's, color scientists were developing the mathematical models. One of the things they did was to take a standard Munsell Book of Color, shine illuminant-C light on the colored chips in the book, and record the data in xyY format. That data-set, called the "Munsell Renotation Data," is the only one that is freely available. Others surely exist, but they are closely held secrets.

Good news though. The data set works good. The Munsell authority today is a company called Gretag Macbeth. I imagine they have voluminous data related to the color-chips they sell. The only numbers I know of that they publish are the D50 Lab and D65 sRGB numbers for a small set of colors on their "Color Checker" cards. I wrote an interpolator based on the old renotation data. It agrees with the numbers for the Color Checker card almost exactly. I regret to inform that so far I have only written code for the conversion that goes the opposite direction from what the OP requested (a year ago, as I type this). It goes from sRGB to Munsell. I click on an image, and the program displays the sRGB and Munsell notations for the area clicked upon. I use it for oil painting.

Color Theory: How to convert Munsell HVC to RGB/HSB/HSL

Footnote: CIE has a standard that is analogous to Munsell. It is called LCh subscripted with a,b. It is Lab* in polar coordinates. The hues are in degrees. Chroma numbers are approximately 5 times the C in Munsell HVC. LCh has its problems though. If you have ever used a photo editor to pump up the vividness of the sky, only to see the blue turn to purple, the program was probably using LCh. When I started writing my program, I was unaware that Bruce Lindloom had done work that parallels what I was doing. His web site was invaluable to me as I finished the project. He designed a space he calls UPLab, which is LCh straightened out to align with Munsell. I had already re-invented LCh and (essentially) UPLab before I discovered Mr. Linbloom's site, but his knowledge of the subject far exceeds mine.


Munsell Renotation System to sRGB Colourspace Conversion

Colour, our open source Python colour science package allows to perform that conversion.

From Munsell Renotation System to CIE xyY Colourspace

The following two definitions based on Centore (2012) method converts between Munsell Renotation System and CIE xyY colourspace:

  • munsell_colour_to_xyY
  • xyY_to_munsell_colour

From CIE xyY Colourspace to sRGB Colourspace

Converting from CIE xyY colourspace to sRGB colourspace is done by first converting to CIE XYZ tristimulus values and then to sRGB colourspace using the following definitions:

  • xyY_to_XYZ
  • XYZ_to_sRGB

Implementation

Here is an annotated complete example using the above definitions:

import colour

# The *Munsell Renotation System* colour we would like to convert
# to *sRGB* colourspace.
MRS_c = '4.2YR 8.1/5.3'

# The first step is to convert the *MRS* colour to *CIE xyY* 
# colourspace.
xyY = colour.munsell_colour_to_xyY(MRS_c)

# We then perform conversion to *CIE xyY* tristimulus values.
XYZ = colour.xyY_to_XYZ(xyY)

# The last step will involve using the *Munsell Renotation System*
# illuminant which is *CIE Illuminant C*:
# http://nbviewer.ipython.org/github/colour-science/colour-ipython/blob/master/notebooks/colorimetry/illuminants.ipynb#CIE-Illuminant-C
# It is necessary in order to ensure white stays white when
# converting to *sRGB* colourspace and its different whitepoint 
# (*CIE Standard Illuminant D65*) by performing chromatic 
# adaptation between the two different illuminant.
C = colour.ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['C']
RGB = colour.XYZ_to_sRGB(XYZ, C)

print(RGB)

[ 0.96820063 0.74966853 0.60617991]

You can also perform the reverse conversion from sRGB colourspace to Munsell Renotation System:

import colour

C = colour.ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['C']

RGB = (0.96820063, 0.74966853, 0.60617991)

print(colour.xyY_to_munsell_colour(colour.XYZ_to_xyY(colour.sRGB_to_XYZ(RGB, C))))

4.2YR 8.1/5.3

References

  • Centore, P. (2012). An open-source inversion algorithm for the Munsell renotation. Color Research & Application, 37(6), 455–464. doi:10.1002/col.20715


The hue specification you've given here is incomplete (4.5 should be 4.5Y etc). Since the link is dead, if anyone is interested, the specs are still alive here: http://web.archive.org/web/20071103065312/http://lib.umich.edu/dentlib/Dental_tables/Colorshadguid.html

The only free utility for Munsell conversion I could find was this:

http://web.archive.org/web/20020809130910/standards.gretagmacbeth.com/cmc/munsell.exe

Very old as you can see, but seems to work well. Current programs that can do this are not free:

  • http://livingstonmanor.net/Munsell2/index.htm
  • http://www.babelcolor.com/main_level/download.htm (this one has a free 14 day trial)

The current holders of the Munsell products are X-Rite, they probably have some conversion solutions as well.

Further, note that the link you supplied includes definitions for the same colors in other color coordinates - namely Yxy and CIE lab*. Both can be freely converted online at http://www.colorpro.com/info/tools/convert.htm or offline with this free color converter


For completeness, here's the archive.org version of my page, that contains the colors in 3 colorspaces, Munsell, Yxy and Lab:

Vita shade-guide colors
_________________________________________________________________

         Munsell         Chromaticity
         notation        coordinates             CIE L* a* b*
         (ref 151)       (ref 152)               (ref 151)
      _____________  _____________________   ___________________
Shade  H    V  C       Y      x      y        L*      a*     b*
_________________________________________________________________

A1    4.5Y 7.80/1.7   55.92  0.3352 0.3459   79.57  -1.61  13.05
A2    2.4Y 7.45/2.3   49.95  0.3468 0.3539   76.04  -0.08  16.73
A3    1.3Y 7.40/2.9   48.85  0.3559 0.3593   75.36   1.36  19.61
A3.5  1.6Y 7.05/3.2   44.12  0.3627 0.3657   72.31   1.48  21.81
A4    1.6Y 6.70/3.1   38.74  0.3633 0.3658   68.56   1.58  21.00
B1    5.1Y 7.75/1.6   54.76  0.3336 0.3447   78.90  -1.76  12.33
B2    4.3Y 7.50/2.2   50.97  0.3437 0.3549   76.66  -1.62  16.62
B3    2.3Y 7.25/3.2   46.91  0.3611 0.3669   74.13   0.47  22.34
B4    2.4Y 7.00/3.2   43.38  0.3620 0.3678   71.81   0.50  22.15
C1    4.3Y 7.30/1.6   47.16  0.3361 0.3462   74.21  -1.26  12.56
C2    2.8Y 6.95/2.3   42.12  0.3487 0.3563   70.95  -0.22  16.72
C3    2.6Y 6.70/2.3   39.11  0.3499 0.3569   68.83  -0.01  16.68
C4    1.6Y 6.30/2.7   33.77  0.3600 0.3622   64.78   1.59  18.66
D2    3.0Y 7.35/1.8   48.71  0.3391 0.3473   75.27  -0.54  13.47
D3    1.8Y 7.10/2.3   44.48  0.3482 0.3534   72.55   0.62  16.14
D4    3.7Y 7.05/2.4   43.45  0.3492 0.3591   71.86  -1.03  17.77
_________________________________________________________________
H        hue
V        value
C        chroma
Y        lightness
x and y  hue and chroma
L*       lightness
a*       hue and chroma on a red/green scale
b*       hue and chroma on a yellow/blue scale

References

  • 151 O'Brien, W.J., Groh, C.L., and Boenke, K.M. A new, small- color-difference equation for dental shades. J.Dent. Res. 69:1762-1764, 1990.
  • 152 O'Brien, W.J., Groh, C.L., and Boenke, K.M. Unpublished data. University of Michigan School of Dentistry, Ann Arbor.


There is a free R package munsell which will (among other things) convert Munsell codes to RGB:

R> library(munsell)
R> mnsl2hex("5PB 5/10")
[1] "#3B75BB"


There's a page I've found here: munsell-to-rgb.blogspot.com that seems to be doing exactly what you are after. It seems unfinished at the moment, but the owner of the blog plans to update it regularly with as many Munsell-to-RGB conversions as he can (and he takes requests!).

It's amazing how hard it is to find accessible conversion tables for these colour systems; hopefully this will be our answer! :D


I'm late to the party, but I found another resource that may be useful on this topic.

Someone at the "Munsell Color Science Laboratory" dug up some 1943 data from Munsell, all based on 1930s Munsell research: http://www.cis.rit.edu/research/mcsl2/online/munsell.php

The page refers to an Excel spreadsheet with the "real colors only" subset of the data that falls within the "Macadam limit", which appears to mean the gamut of colors that can actually appear on reflective surfaces. The spreadsheet link doesn't work, however, but on a hunch I guessed that it left out one level of the directory tree. I tried the URL http://www.cis.rit.edu/research/mcsl2/online/real_sRGB.xls -- and it worked. (I wouldn't be surprised if the owner of the site eventually notices it, and fixes the link, which is likely to break my link.)

I messed with that spreadsheet a little to get it to generate HTML to show me the RGB colors, and added these cells to the spreadsheet:

<table>
  .<colgroup> <col /> <col span="3" style="background-color:#eeeeee;" /> <col span="3" /> <col span="3" style="background-color:#eeeeee;" /> <col span="3" /> <col span="3" style="background-color:#eeeeee;" /> <col span="3" /> <col style="background-color:#eeeeee;" /> <col /> </colgroup>
  ="<tr> <th> "&A1&" </th> <th> "&B1&" </th> <th> "&C1&" </th> <th> "&D1&" </th> <th> "&E1&" </th> <th> "&F1&" </th> <th> "&G1&" </th> <th> "&H1&" </th> <th> "&I1&" </th> <th> "&J1&" </th> <th> "&K1&" </th> <th> "&L1&" </th> <th> "&M1&" </th> <th> "&N1&" </th> <th> "&O1&" </th> <th> "&P1&" </th> <th> "&Q1&" </th> <th> "&R1&" </th> <th> "&S1&" </th> <th> #RGB </th> <th> sample </th> </tr> "
  ="<tr> <td> "&A2&" </td> <td> "&B2&" </td> <td> "&C2&" </td> <td> "&D2&" </td> <td> "&E2&" </td> <td> "&F2&" </td> <td> "&G2&" </td> <td> "&H2&" </td> <td> "&I2&" </td> <td> "&J2&" </td> <td> "&K2&" </td> <td> "&L2&" </td> <td> "&M2&" </td> <td> "&N2&" </td> <td> "&O2&" </td> <td> "&P2&" </td> <td> "&Q2&" </td> <td> "&R2&" </td> <td> "&S2&" </td> <td> #"&T2&" <td style="&CHAR(34)&"background-color:#"&T2&"; width:2em;"&CHAR(34)&"> &nbsp; </td> </tr> "
  ="<tr> <td> "&A3&" </td> <td> "&B3&" </td> <td> "&C3&" </td> <td> "&D3&" </td> <td> "&E3&" </td> <td> "&F3&" </td> <td> "&G3&" </td> <td> "&H3&" </td> <td> "&I3&" </td> <td> "&J3&" </td> <td> "&K3&" </td> <td> "&L3&" </td> <td> "&M3&" </td> <td> "&N3&" </td> <td> "&O3&" </td> <td> "&P3&" </td> <td> "&Q3&" </td> <td> "&R3&" </td> <td> "&S3&" </td> <td> #"&T3&" <td style="&CHAR(34)&"background-color:#"&T3&"; width:2em;"&CHAR(34)&"> &nbsp; </td> </tr> "
  ="<tr> <td> "&A4&" </td> <td> "&B4&" </td> <td> "&C4&" </td> <td> "&D4&" </td> <td> "&E4&" </td> <td> "&F4&" </td> <td> "&G4&" </td> <td> "&H4&" </td> <td> "&I4&" </td> <td> "&J4&" </td> <td> "&K4&" </td> <td> "&L4&" </td> <td> "&M4&" </td> <td> "&N4&" </td> <td> "&O4&" </td> <td> "&P4&" </td> <td> "&Q4&" </td> <td> "&R4&" </td> <td> "&S4&" </td> <td> #"&T4&" <td style="&CHAR(34)&"background-color:#"&T4&"; width:2em;"&CHAR(34)&"> &nbsp; </td> </tr> "
  .
  .
  .
  ="<tr> <td> "&A1626&" </td> <td> "&B1626&" </td> <td> "&C1626&" </td> <td> "&D1626&" </td> <td> "&E1626&" </td> <td> "&F1626&" </td> <td> "&G1626&" </td> <td> "&H1626&" </td> <td> "&I1626&" </td> <td> "&J1626&" </td> <td> "&K1626&" </td> <td> "&L1626&" </td> <td> "&M1626&" </td> <td> "&N1626&" </td> <td> "&O1626&" </td> <td> "&P1626&" </td> <td> "&Q1626&" </td> <td> "&R1626&" </td> <td> "&S1626&" </td> <td> #"&T1626&" <td style="&CHAR(34)&"background-color:#"&T1626&"; width:2em;"&CHAR(34)&"> &nbsp; </td> </tr> "
</table>

The table needs one line each of the ones starting with A2 through A1626, and one each of the others.

I hope this helps.


Despite this old post, to update Steve's answer, here are "corrected" links to RIT's repositories of Munsell data:

https://www.rit.edu/cos/colorscience/rc_munsell_renotation.php

And a direct link to spreadsheet of the sRGB converted values of the "real" Munsell colors:

http://www.rit-mcsl.org/MunsellRenotation/real_sRGB.xls

It's a spreadsheet which includes a conversion from Munsell HVC notation to xyY, then to XYZ_C, then converted to D65 illuminant, then to floating point sRGB, then quantized to 8bit sRGB values (which they call dRGB).

As for the OP's question: sRGB is (obviously) an RGB additive color model. But the differences to other color models such as subtractive CMYK are complex enough that a "simple" algorithm won't handle the conversion — while color model transformations can be approximated with a matrix, more often a LUT (Look Up Table) is preferred, such as a LUT in an ICC profile or a 3D LUT as used in film production. (Not all ICC profiles are LUT based, but a LUT based conversion IMO is what is needed here).

The Munsell data certainly falls into this category, as not only is it a different color model, it is not only a subtractive model it is based on perception, while sRGB is based on a simple relationship between red green and blue light.

The spreadsheet is the useable look-up-table, so then a program to convert things like your dental chart to sRGB would take in that data and reference the LUT contained in the spreadsheet, and return the sRGB values.

Side Note: I want to mention for clarity that although some color-space or color-model transforms can be done reasonably with an algorithm/matrix, 3D LUTs are preferred particularly when the LUTs are created from measured data of a given color-model/space, which maps the many non-linearities inherent in some models.

An extreme example is an sRGB image on your computer monitor vs how that image is printed onto paper and appears on the cover of a magazine sitting on a newsstand illuminated with florescent light. That requires a 3D LUT for an accurate transformation!

In the feature film industry (where I mostly work) we use 3D LUTs throughout the image pipeline, not just for converting/transforms, but for "viewing" and for applying/emulating "looks." For instance taking an image shot with a digital camera and applying a LUT of a certain film stock to that image to make it appear as film.


Since many of the resources of days long past seem to be dwindling away or, as Microsoft puts it, "is not intended for this version of Windows", scraping together as many resources, converters and look-up-tables as possible, is what this Q&A has turned into. Allow me to add one more, then.


Andrew Werth, a US artist, has a tool on their site to convert from Munsell to RGB and HTML hex codes. It's all inside one single .htm file, so I guess it could be downloaded and used on one's desktop as a sort of tool. Actually, that's what I did.

https://www.andrewwerth.com/color/

I like the art, too.

0

精彩评论

暂无评论...
验证码 换一张
取 消