This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Apply device-independent color space transformation


B = applycform(A,C)


B = applycform(A,C) converts the color values in A to the color space specified in the color transformation structure C. The color transformation structure specifies various parameters of the transformation. See makecform for details.

If A is two-dimensional, each row is interpreted as a color unless the color transformation structure contains a grayscale ICC profile. (See Note for this case.) A can have one or more columns, depending on the input color space. B has the same number of rows and one or more columns, depending on the output color space. (The ICC spec currently supports up to 15-channel device spaces.)

If A is three-dimensional, each row-column location is interpreted as a color, and size(A,3) is typically 1 or more, depending on the input color space. B has the same number of rows and columns as A, and size(B,3) is 1 or more, depending on the output color space.

Class Support

A is a real, nonsparse array of class uint8, uint16, or double or a character vector. A is only a character vector if C was created with the following syntax:

C = makecform('named', profile, space)

The output array B has the same class as A, unless the output space is XYZ. If the input is XYZ data of class uint8, the output is of class uint16, because there is no standard 8-bit encoding defined for XYZ color values.

    Note:   If the color transformation structure C contains a grayscale ICC profile, applycform interprets each pixel in A as a color. A can have any number of columns. B has the same size as A.


collapse all

Read color image that uses the sRGB color space into the workspace.

rgb = imread('peppers.png');

Create a color transformation structure that defines an sRGB to L*a*b* conversion.

C = makecform('srgb2lab');

Perform the transformation with applycform.

lab = applycform(rgb,C);

Introduced before R2006a

Was this topic helpful?