• 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!

The "linear DNG" format

Doug Kerr

Well-known member
The "linear DNG" format (in one situation) is essentially a transformation of a raw file (from a CFA camera) in which the raw data has been demosaiced but remains in the native camera color space (rather than, for example, now being in sRGB or L*a*b*).

This fact is often obscured by the common description of this format. It is often said that the image in this format "is in RGB form" but in a way that allows us to have the same opportunity to apply color balance, correct for inopportune exposure, and so forth that we have when working with raw data.

But the letters RGB there are misleading.

It follows from the fact that the outputs of the typical Bayer CFA camera sensor are, by custom, usually designated R, G, and B. But they are almost nothing like the R, G, and B coordinates of the RGB color model, or of any specific RGB color space.

For one thing they are linear, rather than "gamma-precompensated" (as are the RGB coordinates of any usual RGB-class color space). For another, although they are indeed the coordinates of the camera's native color space (a notion denied by some), they do not relate to any visible "red-ish", "green-ish", and "blue-ish" primaries (which might justify the labels "R", "G", and "B").

Actually, the camera native color space has "imaginary"primaries, which not only do not correspond to any visible radiation, they do not correspond to any radiation at all - they are fictional constructs, having no physical significance, which however can be mathematically manipulated just like "visible" primaries. (If that seems startling, recall that the very same is true of the primaries of the CIE XYZ color space - they also have no physical significance!)

So to avoid the cultivation of any misunderstandings, I refer to the outputs of the three classes of sensels in a Bayer CFA camera as α, β, and γ (alpha, beta, and gamma). They are the coordinates of the color space of the raw data.

Yes, it's hard for some people to accept that the outputs of the three kinds of CFA sensels are in fact the coordinates of a color space.​

In a "linear DNG" file, the image is represented by actual pixels, not sensel outputs at pixel locations (as in a raw file), but they are described in the α-β-γ color space (the camera native color space).

Now, what is the significance of this form being called "linear DNG"? Beats me.

Of course, the color space there has linear coordinates, but so does the color space in which regular raw data is recorded (including in a regular DNG file).

For a moment, it might seem that "demosaiced DNG" would have been a better name.

But in some cases (such as a "linear DNG" file from a non-CFA camera, such as one with a "Foveon" sensor), the data was never "mosaiced" to begin with (there were initially three sensor outputs, in the camera's native color space, for each pixel).

So perhaps "pixel DNG" would be an even better name.

Of course, "DNG" (based on "digital negative") is itself misleading. It is based on the metaphor that the raw data is pretty comparable to a film negative.

But in fact, considering what we can do with it, the raw file is most comparable to the exposed, but undeveloped, film. (That's why processing raw data into an image file is often said to be "developing" it, do you think?)

So I'm not attracted to carrying the "DNG" designation into new areas, expanding the area of misunderstanding.

In any case, what we have in a "linear DNG" file is "pixel data in the camera's native color space". I won't pretend to suggest a catchy short name for that.

Best regards,

Doug
 

Andrew Rodney

New member
Actually, the camera native color space has "imaginary"primaries, which not only do not correspond to any visible radiation, they do not correspond to any radiation at all - they are fictional constructs, having no physical significance, which however can be mathematically manipulated just like "visible" primaries. (If that seems startling, recall that the very same is true of the primaries of the CIE XYZ color space - they also have no physical significance!)

ProPhoto (at least one of its primaries) falls into that camp too right?


Now, what is the significance of this form being called "linear DNG"? Beats me.

Of course, the color space there has linear coordinates, but so does the color space in which regular raw data is recorded (including in a regular DNG file).

For a moment, it might seem that "demosaiced DNG" would have been a better name.

But in some cases (such as a "linear DNG" file from a non-CFA camera, such as one with a "Foveon" sensor), the data was never "mosaiced" to begin with (there were initially three sensor outputs, in the camera's native color space, for each pixel).

But in fact, considering what we can do with it, the raw file is most comparable to the exposed, but undeveloped, film. (That's why processing raw data into an image file is often said to be "developing" it, do you think?)

Absolutely!

So I'm not attracted to carrying the "DNG" designation into new areas, expanding the area of misunderstanding.

Seems DNG is being used here more for ‘branding’ than as an accurate descriptor.
 

Doug Kerr

Well-known member
Hi, Andrew,

ProPhoto (at least one of its primaries) falls into that camp too right?

Well, I had not known that but now I just looked and yes, two of them ("G" and "B") are "imaginary; "R" is an actual visible radiation but just barely (I think on the spectral locus at about 700 nm).

Now, what is the significance of this form being called "linear DNG"? Beats me.

Of course, the color space there has linear coordinates, but so does the color space in which regular raw data is recorded (including in a regular DNG file).

For a moment, it might seem that "demosaiced DNG" would have been a better name.

But in some cases (such as a "linear DNG" file from a non-CFA camera, such as one with a "Foveon" sensor), the data was never "mosaiced" to begin with (there were initially three sensor outputs, in the camera's native color space, for each pixel).

Absolutely!

Seems DNG is being used here more for ‘branding’ than as an accurate descriptor.

Indeed!

Interestingly enough, this form is not mentioned at all in the DNG specification! (On the other hand, it doesn't tell anything about how ordinary raw data is packed in a DNG file either. Evidently it is to be done just as prescribed in the TIFF/EF spec - the spiritual Godfather of the DNG file - and one is supposed to know that.)

Best regards,

Doug
 
Now, what is the significance of this form being called "linear DNG"? Beats me.

Hi Doug,

Just guessing, but perhaps they want to make it clear that no precision has been lost yet due to rounded Gamma encoding, and subsequent calculations can be performed faster.

Manipulation of image data in linear gamma space can avoid lots of issues with image arithmetic. Not having to do gamma and inverse gamma calculation can save time. Also, when linearizing gamma precompensated data, some precision is lost. Linear differences map to same integers in gamma space, so original subtle distinctions can get lost. How much of a problem that really is, given 12-14 bit ADCs and demosaicing, remains to be seen.

Cheers,
Bart
 

Michael Tapes

OPF Administrator/Moderator
I have not followed the entire thread, but my thoughts on the "linear" designation.

When discussing RAW processing and one refers to the linear version of the data, the fact that this is a de-bayered 3 channel file (before gamma compensation) rather than a 1 channel raw is inferred. For example a Canon S-raw is not a "true" raw file in the way that we know raw. In fact it is a Linear RAW, meaning that it has been de-bayered (by the camera!) and then down-sampled to the smaller linear version of the data.

I hope that this added and not subtracted from the conversation. If the latter...never mind :>)

Michael
 

Doug Kerr

Well-known member
Hi, Michael,

I have not followed the entire thread, but my thoughts on the "linear" designation.

When discussing RAW processing and one refers to the linear version of the data, the fact that this is a de-bayered 3 channel file (before gamma compensation) rather than a 1 channel raw is inferred.
That may well have been the rationale, but it seems spurious: the values in "regular" raw are not gamma precompensated either!

So, compared to "regular" DNG, "linear DNG" is not more linear, maybe "less raw"!

For example a Canon S-raw is not a "true" raw file in the way that we know raw. In fact it is a Linear RAW, meaning that it has been de-bayered (by the camera!) and then down-sampled to the smaller linear version of the data.

An interesting comparison.

Thanks for your inputs.

Best regards,

Doug
 

Michael Tapes

OPF Administrator/Moderator
For example a Canon S-raw is not a "true" raw file in the way that we know raw. In fact it is a Linear RAW, meaning that it has been de-bayered (by the camera!) and then down-sampled to the smaller linear version of the data.

For those of you who may have missed the implications of shooting sRAW, it means that regardless of what IP software that you use, you will get the Canon de-bayer, and not the Adobe or Capture One or whatever. Not saying that is bad, just that you should know it.
 
Top