diff --git a/misc/utils/Munsell/interpolate-spectra.R b/misc/utils/Munsell/interpolate-spectra.R index 995143ed..c55fe092 100644 --- a/misc/utils/Munsell/interpolate-spectra.R +++ b/misc/utils/Munsell/interpolate-spectra.R @@ -4,8 +4,7 @@ -## TODO: clamp to original range of Munsell chroma -## TODO: clamp to original range of Munsell value +## TODO: clamp to original range of Munsell chroma and value ## TODO: coordinate with `prepare-munsell-LUT.R` diff --git a/misc/utils/Munsell/investigate-spectral-interpolation-errors.R b/misc/utils/Munsell/investigate-spectral-interpolation-errors.R new file mode 100644 index 00000000..473030fe --- /dev/null +++ b/misc/utils/Munsell/investigate-spectral-interpolation-errors.R @@ -0,0 +1,42 @@ +library(purrr) + +data("munsell.spectra.wide") + +nm <- names(munsell.spectra.wide)[-1] +s <- sample(nm, size = 100) + +z <- do.call( + 'rbind', + map(s, .progress = TRUE, .f = function(i) { + spec2Munsell(munsell.spectra.wide[, i]) + }) +) + +z$m <- sprintf("%s %s/%s", z$hue, z$value, z$chroma) + +# compare +cc <- colorContrast( + m1 = s, + m2 = z$m +) + +hist(cc$dE00, breaks = 25) + +## TODO: investigate these +x <- cc[order(cc$dE00, decreasing = TRUE)[1:10], ] + +x + + +# 10G 9.5/10 +.m <- '5YR 2.5/10' +plot(munsell.spectra.wide[, 1], munsell.spectra.wide[, .m], type = 'b', las = 1, main = .m, ylim = c(0, 1.2)) +spec2Munsell(munsell.spectra.wide[, .m]) + + +# 10G 9.5/10 +.m <- '10G 9.5/10' +plot(munsell.spectra.wide[, 1], munsell.spectra.wide[, .m], type = 'b', las = 1, main = .m, ylim = c(0, 1.2)) +lines(munsell.spectra.wide[, 1], munsell.spectra.wide[, '10G 6/10'], type = 'b', col = 2) +lines(munsell.spectra.wide[, 1], munsell.spectra.wide[, '10G 8/6'], type = 'b', col = 2) +spec2Munsell(munsell.spectra.wide[, .m]) diff --git a/misc/utils/Munsell/main.R b/misc/utils/Munsell/main.R index 0864800b..56f3c300 100644 --- a/misc/utils/Munsell/main.R +++ b/misc/utils/Munsell/main.R @@ -19,8 +19,14 @@ source('traditional-names.R') # prepare a simplified spectral library of Munsell color chips source('prepare-simplfied-spectra-library.R') -# interpolate odd chroma and 2.5 value spectra +# interpolate odd chroma and select 1/2 chip value spectra source('interpolate-spectra.R') +# TODO: investigate poor agreement between +# Munsell reference and predicted CIELAB -> Munsell conversion +# these are probably extrapolation artifacts +source('investigate-spectral-interpolation-errors.R') + + # create Munsell hue position data source('make-munsellHuePosition.R')