Image Processing Toolbox User's Guide |
Performing Profile-Based Conversions
The Image Processing Toolbox can perform color space conversions based on device profiles. This section includes the following topics:
Understanding Device Profiles
If two colors have the same CIE colorimetry, they will match if viewed under the same conditions. However, because color images are typically produced for a wide variety of viewing environments, it is necessary to go beyond simple application of the CIE system.
For this reason, the International Color Consortium (ICC) has defined a Color Management System (CMS) that provides a means for communicating color information among input, output, and display devices. The CMS uses device profiles that contain color information specific to a particular device. Vendors that support CMS provide profiles that characterize the color reproduction of their devices, and methods, called Color Management Modules (CMM), that interpret the contents of each profile and perform the necessary image processing.
Device profiles contain the information that color management systems need to translate color data between devices. Any conversion between color spaces is a mathematical transformation from some domain space to a range space. With profile-based conversions, the domain space is often called the source space and the range space is called the destination space. In the ICC color management model, profiles are used to represent the source and destination spaces.
For more information about color management systems, go to the International Color Consortium Web site, www.color.org
.
Reading ICC Profiles
To read an ICC profile into the MATLAB workspace, use the iccread
function. In this example, the function reads in the profile for the color space that describes color monitors.
iccread
returns the contents of the profile in the structure P
. All profiles contain a header, a tag table, and a series of tagged elements. The header contains general information about the profile, such as the device class, the device color space, and the file size. The tagged elements, or tags, are the data constructs that contain the information used by the CMM. For more information about the contents of a profile, see the iccread
function reference page.
Using iccread
, you can read both Version 2 (ICC.1:2001-04) or Version 4 (ICC.1:2001-12) ICC profile formats. For detailed information about these specifications and their differences, visit the ICC web site, www.color.org
.
Writing Profile Information to a File
To export ICC profile information from the MATLAB workspace to a file, use the iccwrite
function. This example reads a profile into the MATLAB workspace and then writes the profile information out to a new file.
iccwrite
returns the profile it writes to the file in P_new
because it can be different than the input profile P
. For example, iccwrite
updates the Filename field in P
to match the name of the file specified as the second argument.
iccwrite
checks the validity of the input profile structure. If any required fields are missing, iccwrite
errors. To determine if a structure is a valid ICC profile, use the isicc
function.
Using iccwrite
, you can export profile information in both Version 2 (ICC.1:2001-04) or Version 4 (ICC.1:2001-12) ICC profile formats. The value of the Version
field in the file profile header determines the format version. For detailed information about these specifications and their differences, visit the ICC web site, www.color.org
.
Example: Performing a Profile-Based Conversion
To illustrate a profile-based color space conversion, this section presents an example that converts color data from the RGB space of a monitor to the CMYK space of a printer. This conversion requires two profiles: a monitor profile and a printer profile. The source color space in this example is monitor RGB and the destination color space is printer CMYK:
www.adobe.com
.)
makecform
function to create the structure, specifying a transformation type string as an argument.
Note The color space conversion might involve an intermediate conversion into a device-independent color space, called the Profile Connection Space (PCS), but this is transparent to the user. |
applycform
function to perform the conversion, specifying as arguments the color data you want to convert and the color transformation structure that defines the conversion. The function returns the converted data.
imwrite
function, specifying the format as TIFF. If the format is TIFF and the data is an m-by-n-by-4 array, imwrite
writes CMYK data to the file.
PhotometricInterpretation
field.
Specifying the Rendering Intent
For most devices, the range of reproducible colors is much smaller than the range of colors represented by the PCS. It is for this reason that four rendering intents (or gamut mapping techniques) are defined in the profile format. Each one has distinct aesthetic and color-accuracy tradeoffs.
When you create a profile-based color transformation structure, you can specify the rendering intent for the source as well as the destination profiles. For more information, see the makecform
reference information.
Converting Between Device-Independent Color Spaces | Converting Between Device-Dependent Color Spaces |
© 1994-2005 The MathWorks, Inc.