makecform

Create color transformation structure

Syntax

C = makecform(type)
C = makecform(type, 'WhitePoint', WP)
C = makecform(type, 'AdaptedWhitePoint', WP)
C = makecform('srgb2cmyk', 'RenderingIntent', intent)
C = makecform('cmyk2srgb', 'RenderingIntent', intent)
C = makecform('adapt', 'WhiteStart', WPS, 'WhiteEnd', WPE, 'AdaptModel', modelname)
C = makecform('icc', src_profile, dest_profile)
C = makecform('icc', src_profile, dest_profile, 'SourceRenderingIntent', src_intent, 'DestRenderingIntent', dest_intent)
C = makecform('clut', profile, LUTtype)
C = makecform('mattrc', MatTrc, 'Direction', direction)
C = makecform('mattrc', profile, 'Direction', direction)
C = makecform('mattrc', profile, 'Direction', direction, 'RenderingIntent', intent)
C = makecform('graytrc', profile, 'Direction', direction)
C = makecform('graytrc', profile, 'Direction', direction, 'RenderingIntent', intent)
C = makecform('named', profile, space)

Description

C = makecform(type) creates the color transformation structure C that defines the color space conversion specified by type. To perform the transformation, pass the color transformation structure as an argument to the applycform function.

The type argument specifies one of the conversions listed in the following table. makecform supports conversions between members of the family of device-independent color spaces defined by the CIE, Commission Internationale de l'Éclairage (International Commission on Illumination). In addition, makecform also supports conversions to and from the sRGB and CMYK color spaces. For a list of the abbreviations used by the Image Processing Toolbox™ software for each color space, see the Remarks section of this reference page.

Type

Description

'cmyk2srgb'

Convert from the CMYK color space to the sRGB color space.

'lab2lch'

Convert from the L*a*b* to the L*ch color space.

'lab2srgb'

Use lab2rgb instead.

'lab2xyz'

Use lab2xyz instead.

'lch2lab'

Convert from the L*ch to the L*a*b* color space.

'srgb2cmyk'

Convert from the sRGB to the CMYK color space.

'srgb2lab'

Use rgb2lab instead.

'srgb2xyz'

Use rgb2xyz instead.

'upvpl2xyz'

Convert from the uvL to the XYZ color space.

'uvl2xyz'

Convert from the uvL to the XYZ color space.

'xyl2xyz'

Convert from the xyY to the XYZ color space.

'xyz2lab'

Use xyz2lab instead.

'xyz2srgb'

Use xyz2rgb instead.

'xyz2upvpl'

Convert from the XYZ to the uvL color space.

'xyz2uvl'

Convert from the XYZ to the uvL color space.

'xyz2xyl'

Convert from the XYZ to the xyY color space.

C = makecform(type, 'WhitePoint', WP) specifies the value of the reference white point. type can be either 'xyz2lab' or 'lab2xyz'. WP is a 1-by-3 vector of XYZ values scaled so that Y = 1. The default is whitepoint('ICC'). Use the whitepoint function to create the WP vector.

C = makecform(type, 'AdaptedWhitePoint', WP) specifies the adapted white point. type can be either 'srgb2lab', 'lab2srgb', 'srgb2xyz', or 'xyz2srgb'. As above, WP is a row vector of XYZ values scaled so that Y = 1. If not specified, the default adapted white point is whitepoint('ICC'). To get answers consistent with some published sRGB equations, specify whitepoint('D65') for the adapted white point.

C = makecform('srgb2cmyk', 'RenderingIntent', intent) and
C = makecform('cmyk2srgb', 'RenderingIntent', intent) specify the rendering intent for transforms of type srgb2cmyk and cmyk2srgb. These transforms convert data between sRGB IEC61966-2.1 and "Specifications for Web Offset Publications" (SWOP) CMYK. intent must be one of these strings: 'AbsoluteColorimetric', 'Perceptual', 'RelativeColorimetric', or 'Saturation'. For more information, see the table Rendering Intent.

C = makecform('adapt', 'WhiteStart', WPS, 'WhiteEnd', WPE, 'AdaptModel', modelname) creates a linear chromatic-adaptation transform. WPS and WPE are row vectors of XYZ values, scaled so that Y = 1, specifying the starting and ending white points. modelname is either 'vonKries' or 'Bradford' and specifies the type of chromatic-adaptation model to be employed. If 'AdaptModel' is not specified, it defaults to 'Bradford'.

C = makecform('icc', src_profile, dest_profile) creates a color transform based on two ICC profiles. src_profile and dest_profile are ICC profile structures returned by iccread.

C = makecform('icc', src_profile, dest_profile, 'SourceRenderingIntent', src_intent, 'DestRenderingIntent', dest_intent) creates a color transform based on two ICC color profiles, src_profile and dest_profile, specifying rendering intent arguments for the source, src_intent, and the destination, dest_intent, profiles.

Rendering intents specify the style of reproduction that should be used when these profiles are combined. For most devices, the range of reproducible colors is much smaller than the range of colors represented by the PCS. Rendering intents define gamut mapping techniques. Possible values for these rendering intents are listed below. Each rendering intent has distinct aesthetic and color-accuracy trade-offs.

Rendering Intent

Value

Description

'AbsoluteColorimetric'

Maps all out-of-gamut colors to the nearest gamut surface while maintaining the relationship of all in-gamut colors. This absolute rendering contains color data that is relative to a perfectly reflecting diffuser.

'Perceptual' (default)

Employs vendor-specific gamut mapping techniques for optimizing the range of producible colors of a given device. The objective is to provide the most aesthetically pleasing result even though the relationship of the in-gamut colors might not be maintained. This media-relative rendering contains color data that is relative to the device's white point.

'RelativeColorimetric'

Maps all out-of-gamut colors to the nearest gamut surface while maintaining the relationship of all in-gamut colors. This media-relative rendering contains color data that is relative to the device's white point.

'Saturation'

Employs vendor-specific gamut mapping techniques for maximizing the saturation of device colors. This rendering is generally used for simple business graphics such as bar graphs and pie charts. This media-relative rendering contains color data that is relative to the device's white point.

C = makecform('clut', profile, LUTtype) creates the color transformation structure C based on a color lookup table (CLUT) contained in an ICC color profile. profile is an ICC profile structure returned by iccread. LUTtype specifies which clut in the profile structure is to be used. Each LUTtype listed in the table below contains the components of an 8-bit or 16-bit LUTtag that performs a transformation between device colors and PCS colors using a particular rendering. For more information about 'clut' transformations, see Section 6.5.7 of the International Color Consortium specification ICC.1:2001-04 (Version 2) or Section 6.5.9 of ICC.1:2001-12 (Version 4), available at www.color.org.

LUT Type

Description

'AToB0' (default)

Device to PCS: perceptual rendering intent

'AToB1'

Device to PCS: media-relative colorimetric rendering intent

'AToB2'

Device to PCS: saturation rendering intent

'AToB3'

Device to PCS: ICC-absolute rendering intent

'BToA0'

PCS to device: perceptual rendering intent

'BToA1'

PCS to device: media-relative colorimetric rendering intent

'BToA2'

PCS to device: saturation rendering intent

'BToA3'

PCS to device: ICC-absolute rendering intent

'Gamut'

Determines which PCS colors are out of gamut for a given device

'Preview0'

PCS colors to the PCS colors available for soft proofing using the perceptual rendering

'Preview1'

PCS colors available for soft proofing using the media-relative colorimetric rendering.

'Preview2'

PCS colors to the PCS colors available for soft proofing using the saturation rendering.

C = makecform('mattrc', MatTrc, 'Direction', direction) creates the color transformation structure C based on a Matrix/Tone Reproduction Curve (MatTRC) model, containing an RGB-to-XYZ matrix and RGB Tone Reproduction Curves. MatTRC is typically the 'MatTRC' field of an ICC profile structure returned by iccread, based on tags contained in an ICC color profile. direction can be either 'forward' or 'inverse' and specifies whether the MatTRC is to be applied in the forward (RGB to XYZ) or inverse (XYZ to RGB) direction. For more information, see section 6.3.1.2 of the International Color Consortium specification ICC.1:2001-04 or ICC.1:2001-12, available at www.color.org.

C = makecform('mattrc', profile, 'Direction', direction) creates a color transform based on the MatTRC field of the given ICC profile structure profile. direction is either 'forward' or 'inverse' and specifies whether the MatTRC is applied in the forward (RGB to XYZ) or inverse (XYZ to RGB) direction.

C = makecform('mattrc', profile, 'Direction', direction, 'RenderingIntent', intent) is similar, but adds the option of specifying the rendering intent. intent must be either 'RelativeColorimetric' (the default) or 'AbsoluteColorimetric'. When 'AbsoluteColorimetric' is specified, the colorimetry is referenced to a perfect diffuser, rather than to the Media White Point of the profile.

C = makecform('graytrc', profile, 'Direction', direction) creates the color transformation structure C that specifies a monochrome transform based on a single-channel Tone Reproduction Curve (GrayTRC) contained in an ICC color profile. direction can be either 'forward' or 'inverse' and specifies whether the grayTRC transform is to be applied in the forward (device to PCS) or inverse (PCS to device) direction. ("Device" here refers to the grayscale signal communicating with the monochrome device. "PCS" is the Profile Connection Space of the ICC profile and can be either XYZ or L*a*b*, depending on the 'ConnectionSpace' field in profile.Header.)

C = makecform('graytrc', profile, 'Direction', direction, 'RenderingIntent', intent) is similar but adds the option of specifying the rendering intent. intent must be either 'RelativeColorimetric' (the default) or 'AbsoluteColorimetric'. When 'AbsoluteColorimetric' is specified, the colorimetry is referenced to a perfect diffuser, rather than to the Media White Point of the profile.

C = makecform('named', profile, space) creates the color transformation structure C that specifies the transformation from color names to color-space coordinates. profile must be a profile structure for a Named Color profile (with a NamedColor2 field). space is either 'PCS' or 'Device'. The 'PCS' option is always available and will return L*a*b* or XYZ coordinates, depending on the 'ConnectionSpace' field in profile.Header, in 'double' format. The 'Device' option, when active, returns device coordinates, the dimension depending on the 'ColorSpace' field in profile.Header, also in 'double' format.

Examples

Convert RGB image to L*a*b*, assuming input image is sRGB.

rgb = imread('peppers.png');
cform = makecform('srgb2lab');
lab = applycform(rgb,cform); 

Convert from a non-standard RGB color profile to the device-independent XYZ profile connection space. Note that the ICC input profile must includes a MatTRC value.

InputProfile = iccread('myRGB.icc');
C = makecform('mattrc',InputProfile.MatTRC, ...
              'direction', 'forward');

More About

expand all

Tips

The Image Processing Toolbox software uses the following abbreviations to represent color spaces.

Abbreviation

Description

xyz

1931 CIE XYZ tristimulus values (2° observer)

xyl

1931 CIE xyY chromaticity values (2° observer), where x and y refer to the xy-coordinates of the associated CIE chromaticity diagram, and l refers to Y (luminance).

uvl

1960 CIE uvY values, where u and v refer to the uv-coordinates, and l refers to Y (luminance).

upvpl

1976 CIE uvY values, where up and vp refer to the uv′-coordinates and l refers to Y (luminance).

lab

1976 CIE L*a*b* values

    Note:   l or L refers to L* (CIE 1976 psychometric lightness) rather than luminance (Y).

lch

Polar transformation of CIE L*a*b* values, where c = chroma and h = hue

cmyk

Standard values used by printers

srgb

Standard computer monitor RGB values, (IEC 61966-2-1)

Was this topic helpful?