Products & Services Solutions Academia Support User Community Company

Learn more about Image Processing Toolbox   

applycform - Apply device-independent color space transformation

Syntax

B = applycform(A,C)

Description

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 1 or more columns, depending on the input color space. B has the same number of rows and 1 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 must be a real, nonsparse array of class uint8, uint16, or double. 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.

Examples

Read in a color image that uses the sRGB color space.

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);

See Also

lab2double, lab2uint8, lab2uint16, makecform, whitepoint, xyz2double, xyz2uint16

For a full list of the toolbox color space conversion functions, see Color Space Conversions.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS