spec2Munsell | R Documentation |
Convert reflectance spectra to closest Munsell chip
spec2Munsell(
x,
res = 10,
convert = TRUE,
SO = c("CIE1931", "CIE1964"),
illuminant = c("D65", "F2"),
...
)
x |
reflectance spectra, must range from 380nm to 730nm with resolution specified in |
res |
spectra resolution in nm, typically 5nm or 10nm |
convert |
logical, convert sRGB coordinates to closest Munsell chip (see |
SO |
CIE standard observer: these are the color matching functions defined by CIE and used to represent "average" human color perception. CIE1931 is the 2 degree standard observer more useful for describing color perception over very small areas or at distance. CIE1964 is the 10 degree standard observer, used for most industrial color matching applications. |
illuminant |
CIE standard illuminants:
|
... |
further arguments to |
See the expanded tutorial for additional examples.
output from col2Munsell()
Marcus, R.T. (1998). The Measurement of Color. In K. Nassau (Ed.), Color for Science, Art, and Technology (pp. 32-96). North-Holland.
CIE Colorimetry – Part 1: CIE standard colorimetric observers. CIES014-1/E:2006 – ISO 11664-1:2007(E)
CIE. (n.d.). CIE 15:2004 Tables Data. Retrieved from https://law.resource.org/pub/us/cfr/ibr/003/cie.15.2004.tables.xls
# Munsell reference spectra
data("munsell.spectra.wide")
# convert to closest Munsell chip
# sRGB -> Munsell conversion via col2Munsell()
spec2Munsell(munsell.spectra.wide[, '10YR 3/3'])
# attempt several
cols <- c('10YR 6/2', '5YR 5/6', '10B 4/4', '5G 4/4', '2.5Y 8/2', '10YR 3/3', '7.5YR 2.5/2')
# most are exact or very close
z <- do.call(
'rbind',
lapply(cols, function(i) {
spec2Munsell(munsell.spectra.wide[, i])
})
)
# format Munsell notation from pieces
z$m <- sprintf("%s %s/%s", z$hue, z$value, z$chroma)
# compare
colorContrastPlot(
m1 = cols,
m2 = z$m,
labels = c('original', 'spectral\ninterpretation')
)
## Not run:
if(requireNamespace("gower")) {
# mix colors, return spectra, convert to color
cols <- c('10YR 6/2', '5YR 5/6', '10B 4/4')
res <- mixMunsell(cols, keepMixedSpec = TRUE, mixingMethod = 'reference')
# note that they are slightly different
res$mixed
spec2Munsell(res$spec)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.