Apply device-independent color space transformation
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 by using the
lab = applycform(rgb,C);
A— Input color space
Input color space, specified as one of the following:
2-D numeric matrix.
applycform interprets each
row as a color unless the color transformation structure,
C, contains a grayscale ICC profile. In
applycform interprets each pixel in
A as a color.
3-D numeric matrix. Each row-column location is interpreted as a
size(A,3) is typically 1 or more,
depending on the input color space.
string or character vector.
A is only a
string or character vector if
C is created with
C = makecform('named', profile, space)
C— Color transformation
Color transformation, specified as a structure. The color transformation
structure specifies various parameters of the transformation. You can create
a color transformation structure using
B— Output color space
Output color space, returned as a numeric array. The size of
B depends on the dimensionality and size of the
input color space,
A is two-dimensional,
B has the same number of rows and one
or more columns, depending on the output color space. (The ICC
specification currently supports up to 15-channel device
A is three-dimensional,
B is the same number of rows and
size(B,3) is 1 or more, depending on the
output color space.