fromXYZ: Convert from XYZ to other Color Spaces

fromXYZR Documentation

Convert from XYZ to other Color Spaces

Description

Convert from XYZ to other Color Spaces

Usage

xyYfromXYZ( XYZ ) 
LabfromXYZ( XYZ, white ) 
LuvfromXYZ( XYZ, white ) 

Arguments

XYZ

a numeric Nx3 matrix with CIE XYZ coordinates in the rows, or a vector that can be converted to such a matrix, by row.

white

a numeric 3-vector giving the XYZ of reference white; all 3 numbers must be positive. white can also be a character string with the name of a standard illuminant, which is passed to standardXYZ() to get the XYZ.

Value

xyYfromXYZ()

returns a numeric Nx3 matrix with CIE xyY coordinates in the rows. If the sum X+Y+Z==0, xy are set to NA.

LabfromXYZ()

returns a numeric Nx3 matrix with CIE Lab coordinates in the rows

LuvfromXYZ()

returns a numeric Nx3 matrix with CIE Luv coordinates in the rows

In all cases, the rownames are copied from input to output. If the input is invalid, the functions return NULL.

References

Wikipedia. CIE 1931 color space. https://en.wikipedia.org/wiki/CIE_1931_color_space

See Also

standardXYZ()

Examples

D65 = standardXYZ( 'D65' )

xyYfromXYZ( D65 )
##              x         y Y
##  D65 0.3127266 0.3290231 1     # probably not familiar

round( xyYfromXYZ(D65), 4 )
##           x     y Y
##  D65 0.3127 0.329 1        # probably more familiar


LabfromXYZ( 0.18*D65, D65 )   # 18% gray card
##             L a b
##  D65 49.49611 0 0          # exactly neutral, and L is about 50


D50 = standardXYZ( 'D50' )

LabfromXYZ( D50, D65 )
##        L        a        b
##  D50 100 2.399554 17.65321   # D50 is far from neutral (yellowish) in D65 viewing environment

spacesXYZ documentation built on May 29, 2024, 6:33 a.m.