ConvertColorSpace — converts a color image from a color space to another one or to a gray level image
Result = ConvertColorSpace(PixelList, Dimensions, Conversion);
linear list of the pixels of a color image, must be a vector of type uint8 or double
vector of type double containing the numbers of rows, columns and channels
constant of type uint8, can be CONVERSION_RGB2GRAY, CONVERSION_RGB2LAB or CONVERSION_LAB2RGB
vector of the same length and type as PixelList
This function transforms the pixels of a color image from one color space to another one. If the list of pixels is of type double, it is transformed to a list of floats internally. This function is called by RGB2Gray, RGB2LAB and LAB2RGB so you do not need to call it yourself.
RGB = ReadImage('contrib\IPD-5.0\demos\teaset.png'); global CONVERSION_RGB2LAB; LABPixelList = ConvertColorSpace(RGB(:), size(RGB), CONVERSION_RGB2LAB); LAB = matrix(LABPixelList, size(RGB)); figure(); ShowImage(LAB(:, :, 1), 'L*'); figure(); ShowImage(LAB(:, :, 2), 'a*'); figure(); ShowImage(LAB(:, :, 3), 'b*');