Greetings,

After pouring over the documentation for the 'colorspace' package, I have not 
been able to figure out how the plot() method converts colorspace coordinates 
to RGB values for display on the screen. I am convert between colorspaces 
with the various as() methods... but cannot seem to find a way to extract RGB 
(i.e. for displaying on a computer screen) triplets from color space 
coordinates.

Here is a sample of the data that I am working with:
        H               V       C               x       y       Y
     2.5Y        0.2         2      1.43      0.97   0.237
     2.5Y        0.4         2     0.729     0.588   0.467
     2.5Y        0.6         2     0.563     0.491   0.699
     2.5Y        0.6         4     0.995     0.734   0.699
     2.5Y        0.8         2     0.479     0.439   0.943
     2.5Y        0.8         4      0.82      0.64   0.943
     2.5Y          1         2    0.4362    0.4177   1.21

I have converted xyY coordinates to XYZ coordinates, based on the equations 
presented here:
http://www.brucelindbloom.com/index.html?ColorCalcHelp.html

#read in the soil colors: munsell + xyY
soil <- read.table("soil_colors", header=F, 
col.names=c("H","V","C","x","y","Y"))

#convert to XYZ
X <- (soil$x * soil$Y ) / soil$y
Y <- soil$Y
Z <- ( (1- soil$x - soil$y) * soil$Y ) / soil$y

#make an XYZ colorspace object:
require(colorspace)
soil_XYZ <- XYZ(X,Y,Z)

#visualize the new XYZ colorspace object in the L*U*V colorspace:
plot(as(soil_XYZ, "LUV"), cex=2)

here is an example of the output:
http://169.237.35.250/~dylan/temp/soil_colors-LUV_space.png

Somehow the plot() method in the colorspace package is converting color space 
coordinates to their RGB values... Does anyone have an idea as to how to 
access these RGB triplets?

Thanks in advance!




-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to