主要内容

Profile-Based Color Space Conversions

如果两种颜色具有相同的CIE比色法,则将匹配if viewed under the same conditions。但是,由于颜色图像通常是针对各种观看环境制作的,因此有必要超越CIE系统的简单应用。

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个人资料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 thesource 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 website,https://www.color.org

阅读ICC配置文件

To read an ICC profile into the workspace, use theiccread有趣的ction. In this example, the function reads in the profile for the color space that describes color monitors.

p = iccread('sRGB.icm');

You can use theiccfind有趣的ction to find ICC color profiles on your system, or to find a particular ICC color profile whose description contains a certain text string. To get the name of the directory that is the default system repository for ICC profiles, useICCROOT

iccread返回结构中配置文件的内容P。所有配置文件都包含一个标题,标签表和一系列标记元素。标题包含有关配置文件的一般信息,例如设备类,设备颜色空间和文件大小。标记的元素或标签是包含CMM使用的信息的数据构造。有关此结构内容的更多信息,请参见iccread有趣的ction reference page.

Usingiccread,您可以同时阅读版本2(ICC.1:2001-04)或版本4(ICC.1:2001-12)ICC配置文件格式。有关这些规格及其差异的详细信息,请访问ICC网站,https://www.color.org

Write ICC Profile Information to a File

To export ICC profile information from the workspace to a file, use theiccwrite有趣的ction. This example reads a profile into the workspace and then writes the profile information out to a new file.

p = iccread('sRGB.icm');p_new = iccwrite(p,'my_profile.icm');

iccwrite将其写入的配置文件返回到文件中p_new因为它可能与输入配置文件不同P。For example,iccwriteupdates theFilenamefield inPto match the name of the file specified as the second argument.

当它创建输出文件时,iccwrite检查输入配置文件结构的有效性。如果缺少任何必需字段,iccwrite返回错误消息。有关写入ICC配置文件数据的更多信息,请参见iccwrite有趣的ction reference page. To determine if a structure is a valid ICC profile, use theisicc有趣的ction.

Usingiccwrite, 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 theVersion文件配置文件标头中的字段确定格式版本。有关这些规格及其差异的详细信息,请访问ICC网站,https://www.color.org

Convert RGB to CMYK Using ICC Profiles

This example shows how to convert color data from the RGB color space used by a monitor to the CMYK color space used by 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:

导入RGB颜色空间数据。此示例将RGB颜色图像导入工作空间。

i_rgb = imread('peppers.png');

阅读ICC配置文件。将源和目标配置文件读取到工作区中。此示例使用SRGB配置文件作为源配置文件。SRGB配置文件是一个行业标准的颜色空间,描述了颜色监视器。

inprof = iccread('sRGB.icm');

对于目标配置文件,该示例使用描述特定颜色打印机的配置文件。打印机供应商提供此配置文件。(以下个人资料和其他几个有用的配置文件可以从下载中获得www.adobe.com

outprof = iccread('ussheetfedcoated.icc');

Create a color transformation structure. You must create a color transformation structure to define the conversion between the color spaces in the profiles. You use themakecform函数创建结构,将转换类型字符串指定为参数。此示例创建了一个颜色转换结构,该结构定义了从RGB颜色数据到CMYK颜色数据的转换。颜色空间转换可能涉及中间转换为独立于设备的颜色空间,称为配置文件连接空间(PCS),但这对用户是透明的。

C = makecform('icc',inprof,eutprof);

执行转换。您使用应用程序执行转换的功能,将要转换的颜色数据指定为参数以及定义转换的颜色转换结构。该函数返回转换后的数据。

i_cmyk = applyCform(i_rgb,c);

Write the converted data to a file. To export the CMYK data, use theimwrite有趣的ction, specifying the format as TIFF. If the format is TIFF and the data is an m-by-n-by-4 array,imwrite将CMYK数据写入文件。

imwrite(i_cmyk,'pep_cmyk.tif',气管无名动脉瘘管的' ')

要验证CMYK数据已写入文件,请使用imfinfo获取有关文件的信息并查看光度法解释field.

info = imfinfo('pep_cmyk.tif');info.PhotometricInterpretation
ans = 'CMYK'

What is Rendering Intent in Profile-Based Conversions?

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.

创建基于配置文件的颜色转换结构时,您可以指定源以及目标配置文件的渲染意图。有关更多信息,请参阅makecformreference information.