Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rgb2munsell

sRGB to Munsell Color Conversion


Description

Convert sRGB color coordinates to the closest n Munsell chips in the munsell lookup table.

Usage

rgb2munsell(color, colorSpace = c("CIE2000", "LAB", "sRGB"), nClosest = 1)

Arguments

color

a data.frame or matrix object containing sRGB coordinates in the range of (0,1)

colorSpace

distance metric (colorspace) to use for finding the closest chip: CIE2000 is the most accurate but requires farver >= 2.0.3, Euclidean distance in CIELAB is a close second, while Euclidean distance in sRGB is not at all accurate and should only be used for demonstration purposes.

nClosest

number of closest Munsell colors to return (valid range is 1-20)

Value

an (NA-padded) data.frame containing hue, value, chroma, and distance (dE00 when colorSpace = 'CIE2000', Euclidean distance otherwise) to nearest matching color.

Note

This function is fully vectorized and will pad output with NA-records when NA are present in color.

Author(s)

D.E. Beaudette

References

Examples

# Munsell notation to sRGB triplets [0-1] 
color <- munsell2rgb(
  the_hue = c('10YR', '2.5YR'), 
  the_value = c(3, 5), 
  the_chroma = c(5, 6), 
  return_triplets = TRUE
)

# result is a data.frame
color

# sRGB triplets to closest Munsell color 
# dE00 distandce metric
# result is a data.frame
rgb2munsell(color)

aqp

Algorithms for Quantitative Pedology

v1.29
GPL (>= 3)
Authors
Dylan Beaudette [aut, cre], Pierre Roudier [aut, ctb], Andrew Brown [aut, ctb]
Initial release
2021-04-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.