[R] grDevices::convertColor XYZ space is it really xyY?

Bryan Hanson hanson at depauw.edu
Wed Jun 12 22:50:35 CEST 2013


Thank you Ken.

90% of my problem was missing the factor of 100.  I was just inputing xyY as a test, I wasn't sure whether the docs were being clear about nomenclature.  Speaking thereof, the D65 values used in the example: I thought they were chromaticity coordinates, but apparently they are tristimulus values - is that correct?

Thanks again.  This solves several problems in a package I am developing.  Bryan

On Jun 12, 2013, at 4:36 PM, Ken Knoblauch <ken.knoblauch at inserm.fr> wrote:

> You seem to treating the input values as xyY when they should be XYZ
> (case matters).
> So, I would do something like this
> 
> D65 <- c(0.3127, 0.329, 0.3583)
> 
> X <- 100 * D65[1]
> Y <- 100 * D65[2]
> Z <- 100 * D65[3]
> XYZ <- data.frame(X = X, Y = Y, Z = Z)
> 
> convertColor(XYZ, from = "XYZ", to = "sRGB")
>     [,1] [,2] [,3]
> [1,]    1    1    1
> 
> 
> Quoting Bryan Hanson <hanson at depauw.edu>:
> 
>> Ken, I followed your suggestion and perhaps I don't understand what  to expect from convertColor or maybe I'm not using it correctly.   Consider the following tests:
>> 
>> D65 <- c(0.3127, 0.329, 0.3583) # D65 chromaticity coordinates
>> X <- D65[1]*D65[3]/D65[2] # conversion per brucelindbloom.com
>> Y <- D65[3]
>> Z <- D65[3]*D65[3]/D65[2]
>> XYZ <- data.frame(X = X, Y = Y, Z = Z) # D65 in tristimulus values (?)
>> colnames(XYZ) <- c("X", "Y", "Z")
>> 
>> tst1 <- convertColor(XYZ, from = "XYZ", to = "sRGB")
>> tst2 <- convertColor(D65, from = "XYZ", to = "sRGB")
>> # none of these are 1,1,1, namely white (they are ~ 0.6, 0.6, 0.6)
>> 
>> So it looks like D65, a white standard, does not come back to  something near white in the sRGB space.  What am I doing wrong here,  or what do I misunderstand?  Please don't say everything!
>> 
>> Thanks, Bryan
>> 
>> On Jun 12, 2013, at 2:57 PM, Ken Knonlauch <ken.knoblauch at inserm.fr> wrote:
>> 
>>> Bryan Hanson <hanson <at> depauw.edu> writes:
>>> 
>>>> 
>>>> grDevices::convertColor has arguments 'from' and 'to' which can
>>> take on value 'XYZ'.  Can
>>> someone confirm
>>>> that 'XYZ' is the same as the CIE chromaticity coordinates
>>> are also sometimes refered to
>>> as 'xyY' in
>>>> the literature?  Or are these the CIE tristimulus values?
>>> It looks to me like the first case is
>>> true, but I
>>>> would appreciate hearing from one of the people in
>>> know.  Thanks, Bryan
>>>> 
>>>> 
>>> 
>>> I.'d look at the code or put in some known data to test it,
>>> but XYZ are tristimulus values and xyY are chromaticity
>>> coordinated and the luminance which is the Y tristimulus
>>> value for the CIE 1931 standard observer.
>>> 
>>> Ken
>>> 
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>> 
>> 
> 
> 
> 
> -- 
> Kenneth Knoblauch
> Inserm U846
> Stem-cell and Brain Research Institute
> Department of Integrative Neurosciences
> 18 avenue du Doyen Lépine
> 69500 Bron
> France
> tel: +33 (0)4 72 91 34 77
> fax: +33 (0)4 72 91 34 61
> portable: +33 (0)6 84 10 64 10
> http://www.sbri.fr/members/kenneth-knoblauch.html
> 
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> 
> 



More information about the R-help mailing list