Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: graphic
See also: lab2rgb rgb2hls hls2rgb

Quantlet: rgb2lab
Description: converts an RGB colour vector into an L*a*b* vector.

Usage: Lab=rgb2lab(RGB)
Input:
Lab (n x 3) array of RGB colours assigned to n objects. The values of the R (red), G (green) and B (blue) channels range from 0 to 255.
n/a (n x 3) array of L*a*b* colours assigned to n objects. L* that ranges from 0 for black to 100 for white corresponds to luminance. L*, a* and b* are non-negative. Not all L*a*b colours can be represented as RGB ones.

Note:

Example:
library("xplore");
library("graphic");
R=255~0~0;
G=0~255~0;
B=0~0~255;
white=255~255~255;
black=0~0~0;
LabR=rgb2lab(R);
LabG=rgb2lab(G);
LabB=rgb2lab(B);
LabWhite=rgb2lab(white);
LabBlack=rgb2lab(black);
LabR;
LabG;
LabB;
LabWhite;
LabBlack;
LabNonRepr1=0~1~1; This colour cannot be represented as RGB
LabNonRepr2=100~1~1; This colour cannot be represented as RGB
RGBNonRepr1=lab2rgb(LabNonRepr1);
RGBNonRepr2=lab2rgb(LabNonRepr2);
RGBNonRepr1;
RGBNonRepr2;

Result:
L*, a* and b* values for red, green, blue,
white and black and the RGB values for
colours that are non-representable as RGB



Author: R.A. Moro, 20050710 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006