CIECAM02 Plug-in


Experimental Implementation of the CIECAM02 Color Appearance Model in a EPhotoshop® Compatible Plug-in (Windows Only) 

*12/5/09 NOTE: This site was recently, automatically migrated from googlepages to google sites. As a result some of the formatting has been lost. This site will be updated soon - I guess it's about time....

The photo above is an example of editing in the CIECAM02 space. The version on the right was enhanced with a simple increase of saturation and a contrast enhancement with the sigmoidal curve tool.

New Version 0.2f 5/11/08

  • Resizable Window

  • Minor bug fixes 

 

Features:

  • Free Download. Click this link and save in your Filters folder:  CIECAM02_0.2f.8bf
  • Forward and Reverse Transforms
  • Double-Floating-Point Accuracy
  • 8 and 16-bit Input, Lab, RGB, XYZ
  • Edit Appearance Correlates (Scale, Offset, Sigmoidal Curve)
  • Choice of Appearance Correlates: Lightness or Brightness, Colorfulness, Chroma, or Saturation.

What is the CIECAM02 Plug-In?

Simply put, the plug-in will take an image and a set of initial viewing conditions, and convert the image so that it will appear the same under a different set of viewing conditions.

CIECAM02 was developed by eminent color scientists under the auspices of the CIE. It is a Color Appearance Model (CAM), which is a method to predict the appearance of colors, taking into account the effect of viewing conditions. CIECAM02 is a complex series of calculations that until now was inconvenient to apply to entire images.

This Photoshop  - compatible plug-in is based on publicly-available CIECAM02 information. The plug-in and this site are in no way associated with the CIE or the CIECAM02 committee.

The CIECAM02 Plug-in was developed using the FilterMeister plug-in development environment and compiler, and works with most image editors that use the Adobe® Photoshop plug-in architecture.

Based on the color space and viewing condition settings selected by the user, the plug-in works by converting the image in the image editor to a perceptual correlate representation that is both device-independent and independent of viewing-conditions. While the image is in this "perceptual correlate space," the user can make adjustments to the perceptual correlates. Then a reverse transform is performed using the same, or different, viewing condition settings and output color space. Optionally this last reverse transform can be skipped and the image can be sent back to the image editor to be worked on while still in the perceptual correlate representation.


What can I do with it?

  • Interactive exploration of the CIECAM02 model. 
  • Chromatic adaptation, optionally including the effects of incomplete adaptation
  • Color space conversions
  • Screen to print matching
  • Gamut mapping
  • Convert to monochrome
  • Modify colorfulness, saturation, or chroma
  • Create new image effects and work flows!

Perceptual Correlates

Perceptual correlates can be thought of as the coordinate system of the CIECAM02 space. The coordinates used in the plug-in are user selectable from the following combinations:

  • JCh - Lightness, Chroma, hue. Most implementations of CIECAM02 are limited to using only JCh mode.
  • Jsh - Lightness, saturation, hue
  • QMh - Brightness, Colorfulness, hue
  • JaCbC - Lightness, a and b rectangular coordinates based on Chroma (C)
  • QaMbM - Brightness, a and b rectangular coordinates based on Colorfulness (M)
  • (other potential combinations not yet implemented in the plug-in)

Note that the JaCbC representation is most similar to CIELAB, where J corresponds to L*, aC corresponds to a*, and bC corresponds to b*. Depending on your application, other representations can be more useful (see Chroma vs. saturation discussion below) .


How to install the Plug-In

Download it from the link at the top of this page. Save the downloaded file in your photo editing application's plug-in or filter folder, for example: C:\Program Files\Adobe\Photoshop CS3\Plug-Ins\Filters. The plug-in will be found under the category "Color Appearance."

Description of the Plugin Window

The plug-in screen is arranged in several sections. On the left side is (1) a proxy image that previews the effect of the plug-in. Below the proxy image is (2) a progress bar , (3) a zoom control, and (4) a sampler info readout.

On the right are a number of controls in three groups, ordered by their positions in the image processing pipeline : (5) FORWARD MODEL controls, (6) PERCEPTUAL CORRELATES controls, and (7) REVERSE MODEL controls. Note that the FORWARD MODEL controls (5) are used to specify the color space and viewing conditions of the input image - the plug-in uses the input information to calculate the CIECAM02 Perceptual Correlates of the image on a pixel-by-pixel basis. The PERCEPTUAL CORRELATES controls (6) work directly on the CIECAM02 perceptual coordinates after they have been calculated in the Forward Model, allowing you to alter the image in the "perceptual space" (such as changing lightness ("J") or increasing saturation ("s")). In the final stage the REVERSE MODEL controls (7) specify the color space and viewing conditions for the transformation from CIECAM02 coordinates back to a final image.

Using the Plug-in

The CIECAM02 Plug-in does not know what color space your image is in, so first you should select the appropriate color space using (8) the Input Space drop-down list. Beside L*a*b* (CIELAB 1976) and common device-independent color spaces such as sRGB and ProPhotoRGB, the plug-in can accommodate CIE XYZ data. Also available is a modification of the ProPhoto RGB profile, called ProPhoto LIN, which has a linear (gamma=1) TRC.

 If the checkbox (9) Auto Space Settings is selected, the plug-in will automatically set all of the remaining FORWARD MODEL controls to appropriate settings for the selected Input Space. If checkbox (10) Match Input is selected for the REVERSE MODEL, then the OUTPUT Space will be automatically set to match the INPUT Space selection. Before running the Plug-in, you probably want to make sure your image is already in one of the available device-independent color spaces, since there is no facility within the Plug-in to assign ICC device profiles.

When the Plug-in is run for the first time, it defaults to the sRGB color space for both input and output. In addition, all of the PERCEPTUAL CORRELATES controls are all set to neutral positions. In this configuration, with all of the FORWARD MODEL settings exactly-matching all of the REVERSE MODEL settings (and the PERCEPTUAL controls at neutral), the Plug-in performs a NULL transformation, that is, there will be effectively no change to the image, even though the Plug-in is actually performing the full "round trip" from color space to perceptual correlates and back, for every pixel in the image. This verifies the accuracy of the plug-in's implementation of the forward and reverse CIECAM02 calculations.

Viewing Conditions Settings

For useful examples, see "Usage Guidelines for CIECAM97s" by Nathan Moroney. (CIECAM97s is the previous CAM, with similar input parameters.)

  • White Point - adopted white, select from list.
  • Adaptation - D factor, select from list: None, 0.1 to 0.9, Complete, or Auto. The default, Auto, calculates D from the other viewing condition settings, according to the CIECAM02 specification. Note that the standard ICC color spaces are defined with adaptation = complete.
  • Surround - select from list: Average, Dim, Dark.
  • Background Lum (Yb) - Background Luminance Factor, range 1-100%, relative to the luminance of the adopted white. Yb is usually estimated to be 20%, however some researchers suggest that the background can be considered to be the whole image, in which case Yb would be the average luminance of the image. To facilitate  the latter, the plug-in automatically calculates the average Y of the image, and provides aveY just below the sampler info readout (4).
  • Adapting Lum (La) - Adapting Luminance in cd/m^2. Note that the Adapting Luminance (La) is not the same as the luminance of white (Lw). La is usually estimated to be 20% of the white luminance Lw, or 0.2 * Lw. More generally, La can be calculated: La =  Lw * Yb / 100 (see Luo). (The luminance of white Lw is not specified as an input to the model, it is calculated internally as 5 * La). For example, to model a monitor with a white luminance of 100 cd/m^2, set La = 0.2 * 100 = 20 cd/m^2.

Average, Dim or Dark Surround

One of the motivations for writing the plugin was to explore differences among print, monitor, and projection viewing. One of the most common complaints of users of Color Management is that printer output fails to match the appearance of an image on a monitor, despite the use of ICC profiles for both monitor and display. In many cases the mismatch is due to viewing conditions, the domain of CIECAM02. The printed image is targeted to an average surround, while monitor viewing usually takes place in a dim or dark surround. Despite monitor calibration procedures such as black point setting that can increase contrast in a way to compensate for dim viewing conditions, the profiling process will tend to undo this and result in monitor colors more suitable for an average surround, regardless of the actual viewing conditions.

To see these effects of the surround on color appearance, change the settings of the FORWARD MODEL Surround (11) and REVERSE MODEL Surround (12) controls.

For example, to match the contrast appearance of an image in an average surround to a digital version of the image viewed on a monitor in a dark surround, set FORWARD Surround = Average, and REVERSE Surround = Dark. The result is an increase in both contrast and Chroma to compensate for the loss of contrast and Colorfulness induced by the dark monitor surround.

 

This next example shows a scan of a Kodak Kodachrome® transparency. This ICC profiled scan is referenced to D50 and demonstrates the usual blue bias of  Kodachrome, due to its being designed for viewing by tungsten-halogen projector light in a dark room. The excess blue compensates for the fact that the eye does not fully adapt to the yellowish projector light. The CIECAM02 plug-in successfully simulates the appearance of the transparency in it's intended viewing conditions including incomplete adaptation.


Chromatic Adaptation

When the white point setting of the Forward Model is different from the Reverse Model, the plugin performs a chromatic adaptation. White points of several standard illuminants are available in the White Point controls' drop-down list.

Below the White Point controls are the Adaptation controls which are used to specify the degree of adaptation, ranging from no adaptation to complete adaptation. The default Auto setting for Adaption uses the standard CIECAM02 calculation to automatically set the degree of adaption based on the other settings.

Modifying Perceptual Correlates

Another motivation to create the plug-in was to explore the use of CIECAM02 as a perceptually-uniform image editing space. For example, it is often desirable to be able to increase the colorfulness of an image, uniformly for all hues (see Evans), and without causing hue shifts.

The Perceptual Correlates sliders operate directly on the selected CIECAM coordinates. The Scale values simply multiply their respective coordinates, then the Offset values are added.

A number of interesting effects are possible with these simple controls. For example, in any mode, reduce the hue Scale to 0, and set hue Offset to 40 to give all pixels in the image the same, skin-like hue. To completely desaturate an image, set Chroma, Saturation , or Colorfulness Scale and Offset to zero.

The J Lightness channel has an an optional sigmoidal curve to provide "soft clipping" when adjusting lightness and contrast, and for fitting an image to the dynamic range of a medium (see Braun and Fairchild, "Image Lightness Rescaling Using Sigmoidal Contrast Enhancement Functions"). Note that the sigmoidal curves work best in the saturation modes (Jsh or Jasbs). See Notes on Saturation vs Chroma, below.

Raw CIECAM02 Data

When the Output Transform checkbox is cleared, the Reverse Transform is skipped. The result after clicking OK is that the plug-in will exit while the image is still in the selected Perceptual Correlates coordinates. The Perceptual Correlates will be scaled to fit the format and bit-depth of your image editor.

Similarly, when the Input Transform checkbox is cleared, the Forward Transform is skipped. Therefore the plug-in will interpret whatever was in your image editor as already being Perceptual Correlates, to be modified by the scale and offset settings and subsequently Reverse Transformed to the OUTPUT Space.

For example, open an sRGB image in your image editor. Run the plug-in, set INPUT Space to sRGB, set Perceptual Correlates to "JCh - Lightness Chroma hue", clear the Output Transform checkbox, and press OK. The plug-in exits, and you now see the image with strange colors in your image editor. The red, green and blue channels in your image editor now hold respectively Lightness, Chroma, and hue. Examine each channel individually. Note that your image editor still assumes that the RGB channels still hold sRGB data, when in fact the channels are holding JCh. Despite the perhaps unusual appearance, you can edit the JCh channels, for example you can run an unsharp mask operation on J Lightness (red channel).

Now run the plug-in again, this time clearing the Input Transform checkbox (since the image is already in the transformed state), restore the checkmark in the Output Transform checkbox, and make sure the OUTPUT Space is sRGB. The image should look normal again in the plug-in proxy window, and when you press OK the image will be back as an sRGB image in your image editor, including any changes you made to it while the was in the intermediate, Perceptual Correlates state.

Note that when Perceptual Correlates are transferred to the image editor as just described, the Perceptual Correlates are quantized to the resolution of the image editor. The quantization could be visible if the editor is only 8 bits per channel. For this reason it is preferable to convert to 16-bit per channel mode before using the plugin to generate raw data.

As mentioned, the Perceptual Correlates are scaled to fit the mode of the image editor. For example, the J lightness range maximum 100 is scaled to 255 in 8-bit, or 32768 in 16-bit. Rectangular chromatic components aC bC, etc., are offset by +128 in order to fit negative values to RGB channels (same as usual method for CIELAB). Similarly, 0-360 degree hues are scaled to 255 or 32768.

Lightness vs Brightness

Lightness (J) in CIECAM02 is similar to Lightness (L*) in CIELAB. Lightness is relative to a perfectly reflecting white surface, ranging to a maximum value 100. Because of this normalization, the Adapting Luminance (La) sliders have only a minor effect on the image appearance while in the Lightness modes.

Brightness (Q) is an absolute measure of lightness. The Adapting Luminance (La) sliders have a direct effect on Brightness. Depending on the chosen viewing conditions, it is easy to cause an image to exceed the encoding range of the target color space. A High Dynamic Range (HDR) encoding would be more appropriate for Brightness (Q) data, but is not yet available in the plug-in. The Adapting Luminance (La) setting of the Reverse Transform can be increased to eliminate clipping, effectively redefining the luminance of the target space.

Saturation vs Chroma

The terms are often used interchangeably, but there is a distinct difference between Saturation and Chroma. When Chroma is held constant, changes in Lightness will also cause a change in chromaticity. When Saturation is held constant and Lightness is changed, chromaticity will tend to be preserved.

To demonstrate the difference, change the Perceptual Correlates to one of the Chroma modes ( JCh or JaCbC) and vary the Lightness scale control to make the image lighter and darker. When Lightness is changed in Chroma mode, even though Chroma is kept constant, the purity of the colors in the image appears to change. As the Lightness is increased, the image becomes less colorful, conversely reducing Lightness results in overly-saturated dark colors. It is well-known that the same effect occurs when editing Lightness in CIELAB, and the reason is that the CIELAB a* and b* coordinates are based on Chroma.

Now change the Perceptual Correlates mode to one of the saturation modes (Jsh or Jasbs). In saturation mode, saturation will not change when Lightness varies. When saturation is held constant, chroma will change in proportion to Lightness so that the effect is similar to varying the photographic exposure (chromaticity is preserved).

Saturation is sometimes described in terms of a "shadow series". An article by Hunt goes into some detail: "Saturation, Superfluous or Superior" .

For these reasons, the sigmoidal lightness curve works best for photographic images in one of the saturation modes.

Lightness, Chroma, and saturation are conceptually related by the following expression (see the discussion in Fairchild, Color Appearance Models)

saturation ~= Chroma / Lightness ~= Colorfulness / Brightness

The choice of Chroma, saturation, or Colorfulness will make a visible difference in the result of the reverse transform.


Limitations

Increasing the scaling of Chroma, saturation, and Colorfulness can result in corruption of some of the darker pixels. The problem has been described by Tastl et. al. and the actual cause is explained in Brill & Susstrunk as being due to gamut limitations in the CIECAM02 inversion. In practice, the problem is usually limited to darker pixels that have very high chroma due to noise.

CIECAM02 was developed from studies of corresponding colors using simple color patches, rather than complex images. Using the model on complex images will sometimes give unexpected results. For example, the model as implemented assumes a neutral background, while in fact a complex image will most likely have a range of different background chromaticities, varying for each pixel.

The plug-in is slow, especially for larger images. At this stage minimal optimization has been done. If there is sufficient interest in the plug-in, I will work on speeding it up.

This site is under constructions. More examples and better explanation will be added soon.

Source Code

Available on request.

References and CIECAM02 Links

Mark D. Fairchild, Color Appearance Models, Addison-Wesley, Reading, MA (1998).

Mark D. Fairchild web site, CIECAM02 papers, spreadsheets.

R.W.G. Hunt, The Reproduction of Colour, 6th Edition, Wiley (2004)

Nathan Moroney Chair of CIE Technical Committee 8-01, website. Includes several papers on CIECAM02 and a java CIECAM02 calculator.

CIE Technical Committee 8-01 web site

M. Ronnier Luo, "The CIE 1997 colour appearance model: CIECAM97s," Chapter 4 of Colour Engineering, edited by P.J. Green and L.W. MacDonald, 2002 John Wiley & Sons Ltd.

Michael H. Brill and Sabine Süsstrunk, "Repairing Gamut Problems in CIECAM02: A Progress Report" http://infoscience.epfl.ch/search.py?recid=111596

Handprint.com http://www.handprint.com/HP/WCL/color7.html Discussion of CIECAM02 and other color models.

Ralph M. Evans, An Introduction to Color, Wiley (1948)

Billy Biggs, "Notes on the CIECAM02 Colour Appearance Model" with C code.

Graeme Gill, Argyll CMS, includes CIECAM02 options.

Comments, Corrections, Suggestions, etc.

Comments, questions, and bug reports are welcome. Please send them to the following Google Group which was created solely for discussion of the plug-in:

Google Groups Beta
CIECAM02Plugin
Visit this group