Open Photography Forums  

Go Back   Open Photography Forums > Color Management Discussion > CM Theory and Practice

CM Theory and Practice Profiles, color spaces, perception, science.

Thread Tools Display Modes
Old September 25th, 2010, 10:45 AM
Doug Kerr Doug Kerr is offline
Senior Member
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,196
Default The DNG profile - a curiosity

The specification for the digital negative file (DNG) includes provision for a camera calibration profile, to be embedded in a DNG file (or used otherwise).

The purpose of this is to guide, during processing of the camera raw data, correction for inconsistent colorimetric response of the camera (as has perhaps been characterized by testing).

The organization of this profile gives the potential of applying corrections to the color "directly implied" by the raw data (in terms of hue, saturation, and/or luminance) that are different for different regions of the color space. For example, that means that a different hue adjustment could be applied for two implied colors that were the same in hue and saturation but different in luminance.

The profile is not set up to be applied at the raw data level. Rather, it is applied once the raw data has been demosaiced (and perhaps otherwise processed) into an image in an RGB-style color space.

In the DNG specification, the profile is not well-defined. There are excruciating details of its data structure, but the only "definition" of its principle is given by a section describing how the profile is to be applied to a camera file during processing of the raw data. I will paraphrase that here:

1. Convert the raw data (however you will) to a linear "RGB-style" color space using the primaries of the ProPhoto color space. [This turns out to be one of the two defined versions - the linear one - of the "RIMM" (Reference Input Medium Metric) color space.]

2. Convert the image from this to the HSV color space. [Extensive discussion of this shortly.]

3. For each pixel, enter the camera calibration table with the H, S, and V values. [The table has a three-dimensional "index", in H, S, and V. Of course, we need to go to the "closest" entry - not every possible combination of H, S, and V has its own entry. This is a "quantization" matter.]

4. Apply the H, S, and V adjustments from that table entry to the "incoming" HSV values for the pixel, giving an "adjusted" HSV representation.

5. Convert the adjusted HSV representation into the color space to be used for the "delivered" image (or more likely to XYZ to pass to the "output" profile).

At step 2, we encounter several complications.

Firstly, there is no "standardized" definition of "the HSV" color space. Numerous color spaces with coordinates having those letters have been used, generally in the "color choosers" of various graphics programs. They differ substantially in their details (even their concepts). The DNG specification does not define the particular transform to HSV that is to be used, nor does it cite any "specification" for it.

One widely recognized form of the HSV color space may be that originally proposed by Alvy Ray smith in 1978. (I have not yet acquired his original paper, so I can't be sure.) This is likely the version described by the current Wikipedia article on this color space.

It is defined by a set of well-known equations as a transform from the representation of colors by the coordinates R, G, and B. It does not presuppose any particular RGB-family color space, just the one currently in use. Note, however, that in all of those, the coordinates R, G, and B are nonlinear representations of the underlying "linear" values.

Now in step 2, we start with the pixel color in linear form (rgb, in my notation here). So what does it mean to convert this to the HSV color space (even stipulating that the Photoshop form of HSV is meant)?

Well, it might mean any of these:

1. Use the Photoshop RGB-to-HSV equations, but work them on the linear values (which I call r, g, and b) rather than R, G, and B. This of course defines a new, previously unheard of, color space. (I would perhaps call it, in detailed technical writing, "hsv".)

2. Convert the "linear RIMM" representation (derived in step 1) to the nonlinear RIMM representation (this involves using the same nonlinear function defined for the sRGB color space) and then use the Photoshop RGB-to-HSV equations on the resulting values of R, G, and B.

3. Actually, in step 1, do not convert the nascent image to a linear color space using the ProPhoto primaries but rather to the actual ProPhoto color space (which uses a nonlinear function with an exponent of 1.8).

I's be pleased to hear from anyone working in this field that could advise which of these (or perhaps something wholly different) is meant.

Best regards,


Last edited by Doug Kerr; September 25th, 2010 at 04:14 PM.
Reply With Quote
Old September 26th, 2010, 07:39 AM
Doug Kerr Doug Kerr is offline
Senior Member
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,196

When I wrote the note at the head of this thread, I expressed dismay that, while conversion to "the HSV" color space was prescribed by the DNG specification as a stage of the application of a DNG camera calibration profile (and thus in effect forms part of the definition of the profile itself), there were "various" recognized HSV color spaces. which I had said elsewhere were found in the "color choosers" of different graphics programs.

Since then I have done a further review of the literature and my own observations, and find that the situation is not nearly so perilous as I had suggested. It now seems that only two versions of the HSV color space, both well defined, are described in the literature:

The "classical" HSV color space, described in August of 1978 by Alvy Ray Smith. A criterion for the development of this space is that the transforms to and from an RGB color space should not be computationally-demanding, which in particular suggests that the definitions of the transforms not involve trigonometric functions (and preferably not square roots either).

An "updated" HSV color space, whose "founder" I have not yet been able to identify. The equations defining its transforms to and from an RGB color space do involve trigonometric functions and square roots. Although I grasp the geometric concept underlying the difference between it and the "Smith" HSV model, I have not yet discerned what its advantage is.

In any case, the differences in the coordinates of any given actual color between the two spaces are modest.

By way of some bush-league reverse engineering, I have ascertained that the "HSB color model" which is one of the available user input modes for the color chooser in Photoshop (modern versions) is in fact the original (Smith) version of the HSV color space.

Often the designation B (mnemonic for "brightness") is used rather than "V" (mnemonic for "value") to improve the user's grasp of more-or-less what property does the coordinate more-or-less correspond to.
Smith, in his paper, gives a rationale for the use of the word "value", and draws a conceptual distinction from "brightness". Note that in any case, the V/B coordinate does not correspond very directly to the formal colorimetric properties luminance or brightness. Whatever name is given is arbitrary.
I still hope to learn which of the two recognized forms of the HSV color space is the one intended in the DNG specification.

Best regards,

Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Color Management and Adobe Photoshop Nigel Lew Printing 16 April 15th, 2011 11:59 AM
DNG Profile Editor for LR2 & ACR4.5 Stefan Hellstrom Image Processing and Workflow 5 September 1st, 2008 07:19 AM
HP Z3100 Profile Names vrs Corel Painter X CM Tom Bulat CM Theory and Practice 0 October 2nd, 2007 03:05 PM
New CM techniques Tim Armes CM Theory and Practice 9 August 14th, 2007 01:29 PM
nub q: how to compare mini-lab print result to profile? bonnyr CM Theory and Practice 1 December 14th, 2006 06:21 PM

All times are GMT -7. The time now is 12:26 AM.

Posting images or text grants license to OPF, yet of such remain with its creator. Still, all assembled discussion 2006-2017 Asher Kelman (all rights reserved) Posts with new theme or unusual image might be moved/copied to a new thread!