• Please use real names.

    Greetings to all who have registered to OPF and those guests taking a look around. Please use real names. Registrations with fictitious names will not be processed. REAL NAMES ONLY will be processed

    Firstname Lastname

    Register

    We are a courteous and supportive community. No need to hide behind an alia. If you have a genuine need for privacy/secrecy then let me know!
  • Welcome to the new site. Here's a thread about the update where you can post your feedback, ask questions or spot those nasty bugs!

DNG - the tranformation to "HSV"

Doug Kerr

Well-known member
In connection with the application of the HSV mapping table, the DNG specification calls for the following preparatory steps:

• Transform the image into a linear color space with the ProPhoto RGB primaries. (This constitutes the "linear" form of the RIMM color space.)

• Transform that image into the HSV color space.

I am not aware of any "official" definition of the HSV color space, but Alvy Ray Smith's original definition (1978) is widely followed. It of course defines the transform from an RGB-model color space into the coordinates H, S, and V, by way of a set of equations (actually, in one area, by pseudo-code).

But there is also widely mentioned an alternative form, evidently intended to remove the intellectual untidiness of the "quasi-angular" notion used by smith for hue (H). (It works in terms of the fractional linear distance along a hexagonal path, "all the way around" counting as 360°.)

Of course, normally, the coordinates RGB, used as inputs to the "Smith" equations, are in nonlinear form (the exact nonlinear function depending on the particular RGB-model color space from which we start).

I had questioned whether the provision in the DNG spec is intended to be that we would apply the "Smith" equations, as is, to the linear values (r, g, and b) involved after the first stage of the specified procedure (transformation to linear RIMM space).

Our colleague Andrew Rodney was kind enough to post that query in one of the Adobe forums, and "Sandy" there was kind enough to cite the C code from the DNG System Development Kit for the routine in which the second stage of the procedure is actually performed. (I actually have the SDK code, à propos that possibility, but I was hoping not to have to trace through the whole thing until I got to the relevant routine!)

The answer is:

Yes, the algorithm contemplated by the specification uses the "Smith" equations (in a commonly-published recasting, intended to make them more understandable), but applying them to the "linear" tristimulus values, r, g, and b, representing the color in the linear RIMM color space.

It is a curious recipe, but one that is workable.

(It is no more curious than calculating a "quasi luminance" - such as the "Y" of YCbCr - as a weighted sum of the nonlinear coordinates R, G, and B, using the same weighting coefficients that would be used in a determination of true luminance as a weighted sum of the linear coordinates, r, g, and b.)

Thanks again to Andrew and "Sandy".

Best regards,

Doug
 
Top