Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 204742

How to convert from CIE XYZ to Munsell and back in R

$
0
0

I am trying to implement a conversion from the CIE XYZ color space to the Munsell specifications, using the package munsellinterpol in R (to my knowledge, this package is based on the Kubelka-Munk toolbox that is also available, e.g., in Matlab).

Anyway, converting from Munsell to XYZ works without problems:

MunsellToXYZ("2.22Y 3/9")
# $X
# [1] 7.062125

# $Y
# [1] 6.391178

# $Z
# [1] -0.4203379

# $Status.ind
# [1] 1

However, going the other way doesn't seem to work:

XYZtoMunsell(c(7.062125, 6.391178, -0.4203379))
# $Status.ind
# [1] 4

# $Status.dist
# NULL

# $Status.num
# NULL

Also, the first time the function is called, R outputs a weird error:

PLEASE NOTE:  As of version 0.3-5, no degenerate (zero area) 
regions are returned with the "Qt" option since the R 
code removes them from the triangulation. 
See help("delaunayn").

I know that the functions utilize some kind of optimization to approximate a good mapping based on the Munsell renotation data. And I do realize that not all colors may have a good Munsell mapping. But I would expect the functions to at least work forwards and backwards, which doesn't seem to be the case.

Indeed, not even the example given in the documentation works:

XYZtoMunsell(c(0.310897, 0.306510, 74.613450))
# $Status.ind
# [1] 4

# $Status.dist
# NULL

# $Status.num
# NULL

Any help would be much appreciated. Thanks in advance.


Viewing all articles
Browse latest Browse all 204742

Trending Articles