section of routines in lab2rgb.i

functions in lab2rgb.i -

 
 
 
lab2rgb


             srgb = lab2rgb(lab)  
 
   Returns sRGB, the IEC 61966-2-1 is RGB on a canonical monitor, given  
   the CIELAB.  By default, lab2rgb returns a char [r,g,b] (of the same  
   dimensions as LAB, with the color index last), normalized to [0,255],  
   but you can specify a different maximum color value using the cmax=  
   keyword.  In particular, cmax=1 results in a double array normalized  
   to lie in [0.,1.].  
    
   The required reference white value is D65 white, which gives  
   [255,255,255] and coresponds to LAB=[100,0,0].  The L coordinate is  
   perceived luminance, and the angle in the (A,B) plane is hue.  The  
   red-green component A is negative for green, positive for magenta,  
   while the blue-yellow component B is negative for blue and positive  
   for yellow.  Euclidean distance in 3D LAB space represents the  
   perceptual difference between two colors.  
    
   LAB colors may not be representable in rgb.  You can check the  
   external variable srgb_clip after a call to lab2rgb to find out  
   if any colors have been clipped; it has the same dimensions as the  
   input and is 1 where a color is clipped, otherwise 0.  
    
   Notes: chroma = abs(B, A)  hue = atan(B, A)  saturation = chroma/L  
    
   External variables lrgb_skip, lrgb_gamma, or lrgb_clipper affect this  
   function; see rgb_l2s for details.  
SEE ALSO: rgb2lab,   rgb2xyz,   xyz2rgb,   rgb2luv,   luv2rgb,  
rgb_s2l  
 
 
 
lrgb_clip


             clipped_lrgb = lrgb_clip(lrgb)  
 
    
    With input LRGB = physically linear [r,g,b] as real values (final  
    index is length 3), clip any colors with one or more components  
    outside the interval [0,1] along a line from lrgb to the gray  
    with the same luminance.  The clipped LRGB will always have at  
    least one component either 0 or 1.  This procedure maintains the  
    CIE Luv luminance and hue, simply desaturating the color until it  
    fits inside the gamut.  (Note that CIE Lab hue is not maintained.)  
    
    You can set the external variable lrgb_gray to any value you want  
    in order to define the "gray with the same luminance" as something  
    other than the CIE Luv luminance.  The gray value will be  
    LRGB(..,+)*lrgb_gray(+)/sum(lrgb_gray).  The default is equivalent  
    to lrgb_gray = _xyz_rgb(2,), the CIE Y value.  
    
    You can force rgb_l2s to clip using lrgb_clip by setting the  
    external variable l2s_clipper = lrgb_clip.  
    
SEE ALSO: rgb_l2s,   luv2rgb  
 
 
 
luv2rgb


             srgb = luv2rgb(luv)  
 
   Returns sRGB, the IEC 61966-2-1 is RGB on a canonical monitor, given  
   the CIELUV.  By default, luv2rgb returns a char [r,g,b] (of the same  
   dimensions as LUV, with the color index last), normalized to [0,255],  
   but you can specify a different maximum color value using the cmax=  
   keyword.  In particular, cmax=1 results in a double array normalized  
   to lie in [0.,1.].  
    
   The required reference white value is D65 white, which gives  
   [255,255,255] and coresponds to LUV=[100,0,0].  The L component is  
   perceptual luminance, abs(v,u) is perceptual chroma, and atan(v,u)  
   is perceptual hue.  Euclidean distance in LUV is perceived color  
   color difference.  
    
   LUV colors may not be representable in rgb.  You can check the  
   external variable srgb_clip after a call to luv2rgb to find out  
   if any colors have been clipped; it has the same dimensions as the  
   input and is 1 where a color is clipped, otherwise 0.  You can also  
   set the external variable l2s_clipper (to the function lrgb_clip,  
   for example) to get more sophistocated clipping for colors outside  
   the RGB gamut.  The lrgb_clip function maintains Luv luminance and  
   hue and desaturating the color until it fits within the gamut.  
    
   The Luv luminance (L component) is identical to the Lab L component,  
   and is a function only of the XYZ Y component.  The (u,v) components,  
   like the (a,b) components are (0,0) for gray colors, so that hue  
   varies with angle around (a,b).  The difference is, that the (u,v)  
   coordinates are chosen so that lines of constant Luv hue (slope v/u)  
   are straight lines in XYZ (or lRGB) space.  The lines of constant  
   Lab hue (slope b/a), on the other hand, are curves in XYZ space.  
    
   Notes: chroma = abs(V, U)  hue = atan(V, U)  saturation = chroma/L  
    
   External variables lrgb_skip, lrgb_gamma, or lrgb_clipper affect this  
   function; see rgb_l2s for details.  
SEE ALSO: rgb2luv,   rgb2xyz,   xyz2rgb,   rgb2lab,   lab2rgb,  
rgb_s2l,   lrgb_clip  
 
 
 
rgb2lab


             xyz = rgb2lab([r, g, b])  
         or xyz = rgb2lab(r, g, b)  
 
   Returns CIEXYZ, given RGB on a canonical monitor (the IEC 61966-2-1 sRGB).  
   Return value has same dimensions as input (in first form).  
   If input rgb are real, they are assumed normalized to lie in [0.,1.].  
   If input are integers, they are assumed to lie in [0,255].  
   You can specify a different maximum color value using the cmax= keyword.  
    
   The required reference white value is D65 white, which gives  
   [255,255,255] and coresponds to LAB=[100,0,0].  The L coordinate is  
   perceived luminance, and the angle in the (A,B) plane is hue.  The  
   red-green component A is negative for green, positive for magenta,  
   while the blue-yellow component B is negative for blue and positive  
   for yellow.  Euclidean distance in 3D LAB space represents the  
   perceptual difference between two colors.  
    
   Notes: chroma = abs(B, A)  hue = atan(B, A)  saturation = chroma/L  
    
   External variables lrgb_skip, lrgb_gamma, or lrgb_clipper affect this  
   function; see rgb_l2s for details.  
SEE ALSO: lab2rgb,   rgb2xyz,   xyz2rgb,   rgb2luv,   luv2rgb,  
rgb_l2s  
 
 
 
rgb2luv


             xyz = rgb2luv([r, g, b])  
         or xyz = rgb2luv(r, g, b)  
 
   Returns CIEXYZ, given RGB on a canonical monitor (the IEC 61966-2-1 sRGB).  
   Return value has same dimensions as input (in first form).  
   If input rgb are real, they are assumed normalized to lie in [0.,1.].  
   If input are integers, they are assumed to lie in [0,255].  
   You can specify a different maximum color value using the cmax= keyword.  
    
   The required reference white value is D65 white, which gives  
   [255,255,255] and corresponds to LUV=[100,0,0].  The L component is  
   perceptual luminance, abs(v,u) is perceptual chroma, and atan(v,u)  
   is perceptual hue.  Euclidean distance in LUV is perceived color  
   color difference.  
    
   Notes: chroma = abs(V, U)  hue = atan(V, U)  saturation = chroma/L  
    
   External variables lrgb_skip, lrgb_gamma, or lrgb_clipper affect this  
   function; see rgb_l2s for details.  
SEE ALSO: luv2rgb,   rgb2xyz,   xyz2rgb,   rgb2lab,   lab2rgb,  
rgb_l2s  
 
 
 
rgb2xyz


             xyz = rgb2xyz([r, g, b])  
         or xyz = rgb2xyz(r, g, b)  
 
   Returns CIEXYZ, given RGB on a canonical monitor (the IEC 61966-2-1 sRGB).  
   Return value has same dimensions as input (in first form).  
   If input rgb are real, they are assumed normalized to lie in [0.,1.].  
   If input are integers, they are assumed to lie in [0,255].  
   You can specify a different maximum color value using the cmax= keyword.  
   External variables lrgb_skip, lrgb_gamma, or lrgb_clipper affect this  
   function; see rgb_l2s for details.  
SEE ALSO: xyz2rgb,   lab2rgb,   rgb2lab,   rgb2luv,   rgb_l2s  
 
 
 
rgb_l2s


             srgb = rgb_l2s(rgb_linear)  
 
   Returns sRGB, the IEC 61966-2-1 is RGB on a canonical monitor, given  
   the physically linear RGB_LINEAR = [rlin, glin, blin], which is  
   always normalized to lie in [0.,1.].  By default, rgb_l2s returns  
   a char [r,g,b] (of the same dimensions as RGB_LINEAR, with the  
   color index last), normalized to [0,255], but you can specify a  
   different maximum color value using the cmax= keyword.  In particular,  
   cmax=1 results in a double array normalized to lie in [0.,1.] like  
   the input RGB_LINEAR.  
    
   The input RGB_LINEAR is clipped to the interval [0,1].  By default,  
   the clipping just chops any component value above 1 to 1 and below  
   0 to 0.  By setting the external variable l2s_clipper to a function  
   you can use a more sophistocated clipping algorithm.  In particular,  
   l2s_clipper = lrgb_clip gives you a constant hue clipper.  In any  
   event, rgb_l2s sets the external variable srgb_clip to be an array  
   with the same dimensions as LINEAR_RGB which is 1 for any clipped  
   color component, and 0 for unclipped components.  
    
   You can also set the external variable lrgb_gamma to use a pure  
   power law gamma for the conversion instead of the sRGB IEC 61966-2-1  
   canonical monitor function.  Finally, if you set the 1 bit of the  
   external variable lrgb_skip, rgb_l2s becomes a no-op.  If you set  
   the 2 bit of lrgb_skip, the rgb_s2l function becomes a no-op.  Do  
   not set lrgb_skip as a global variable; make it local to the function  
   requiring this non-standard behavior.  
    
SEE ALSO: rgb_s2l,   rgb2xyz,   rgb2lab,   rgb2luv,  
lrgb_clip  
 
 
 
rgb_s2l


             rgb_linear = rgb_s2l([r, g, b])  
         or rgb_linear = rgb_s2l(r, g, b)  
 
    
   Returns physically linear red-green-blue, given RGB on a canonical  
   monitor (the IEC 61966-2-1 sRGB).  
   Return value has same dimensions as input (in first form).  
   If input rgb are real, they are assumed normalized to lie in [0.,1.].  
   If input are integers, they are assumed to lie in [0,255].  
   You can specify a different maximum color value using the cmax= keyword.  
    
   You can also set the external variable lrgb_gamma to use a pure  
   power law gamma for the conversion instead of the sRGB IEC 61966-2-1  
   canonical monitor function.  Finally, if you set the 2 bit of the  
   external variable lrgb_skip, rgb_s2l becomes a no-op.  
    
SEE ALSO: rgb_l2s,   rgb2xyz,   rgb2lab,   rgb2luv  
 
 
 
xyz2rgb


             srgb = xyz2rgb(xyz)  
 
   Returns sRGB, the IEC 61966-2-1 is RGB on a canonical monitor, given  
   the CIEXYZ.  By default, xyz2rgb returns a char [r,g,b] (of the same  
   dimensions as XYZ, with the color index last), normalized to [0,255],  
   but you can specify a different maximum color value using the cmax=  
   keyword.  In particular, cmax=1 results in a double array normalized  
   to lie in [0.,1.].  
   XYZ colors may not be representable in rgb.  You can check the  
   external variable srgb_clip after a call to xyz2rgb to find out  
   if any colors have been clipped; it has the same dimensions as the  
   input and is 1 where a color is clipped, otherwise 0.  
   External variables lrgb_skip, lrgb_gamma, or lrgb_clipper affect this  
   function; see rgb_l2s for details.  
SEE ALSO: rgb2xyz,   lab2rgb,   rgb2lab,   rgb2luv,   rgb_s2l