Open Photography Forums  
HOME FORUMS NEWS FAQ SEARCH

Go Back   Open Photography Forums > Digital Camera Discussion > Imaging Technology: Theory, Alternatives, Practice and Advances.

Imaging Technology: Theory, Alternatives, Practice and Advances. This is a brand independent discussion of theory, process or device. Ignore this forum unless this matters to you!

Reply
 
Thread Tools Display Modes
  #1  
Old October 8th, 2015, 03:30 PM
Doug Kerr Doug Kerr is offline
Senior Member
 
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,487
Default Lens corrections in Leica raw (DNG) files

A while ago, Asher mentioned, rather in passing, while discussing some topic, that in some Leica cameras, a correction for the "color cast" of the lens in place was applied to the raw data before it was delivered in the raw file. In later discussions, he told me that he thought the same might be so of Hasselblad digital cameras and PhaseOne digital camera backs.

I wasn't aware of this kind of arrangement (there are so many things of which I am not aware!), and I was interested to learn more about it. I had a number of questions, including:

If there any chance that what actually happens here is not that the correction is made to the raw data but rather that a description of the needed correction (based on the lens in place) was included in the raw file so the correction could be applied by the raw development software. (Not of course that I thought Asher was possibly confused as to the details here, but I just like to be sure.)

Is this same thing done with regard to other lens-dependent corrections, such as vignetting and geometric distortion?

On my way to learning more about this matter, I came to realize that many (if not all) Leica cameras (not including those made by Panasonic) deliver their raw data as a DNG file.

Today I got very complete information on this from Sandy McGuffog, host of the ChromaSoft blog, and the developer of AccuRaw, a raw developing program for the Mac. Here's the scoop.

In the Leica M system, the lenses, having mostly been designed for film cameras, typically have very little geometric distortion, but may exhibit a substantial color cast and/or (especially for wide-angle lenses) significant vignetting.

In the digital context, it is very practical, technically, to correct for both lens color casts and vignetting in the raw data (that is, to modify the raw data to effect the corrections before the raw data is delivered in the DNG file), and Leica in fact typically does that (assuming that the lens involved identifies itself to the body, which is done with an optical coding system).

Then, no later part of the processing chain need be concerned with this matter. It is as if the lens exhibited no color cast nor vignetting.

In other Leica cameras, such as the Q series, the lenses are designed for the digital context. They are typically very low in color casts and vignetting, but may have significant geometric distortion.

It is not really practical to correct for geometric distortion in the delivered raw data. Rather, in those Leica cameras, "instructions" for applying that kind of correction are included in the raw (DNG) file, They are used to control the application of the correction while the image is being developed by external raw development software. These instructions are in the form of "opcodes" (short for "operation codes"), which we can think of as macros that perform the corrections. (The DNG format, in its present from, gladly accommodates such opcodes.)

Now, while I was seeking to lean more about this whole topic, I asked Check Westfall of Canon USA whether any Canon cameras make any kinds of "corrections" to the raw data before it is delivered in a raw file. His answer was essentially, "not that he knows of", with the caveat that Canon does not tell even him everything that goes on in a Canon raw file.

So that's what we now know here about that.

Best regards,

Doug

Last edited by Doug Kerr; October 8th, 2015 at 06:53 PM.
Reply With Quote
  #2  
Old October 8th, 2015, 11:07 PM
Jerome Marot Jerome Marot is offline
Senior Member
 
Join Date: Jan 2011
Location: Munich, Germany.
Posts: 3,712
Default

Quote:
Originally Posted by Doug Kerr View Post
A while ago, Asher mentioned, rather in passing, while discussing some topic, that in some Leica cameras, a correction for the "color cast" of the lens in place was applied to the raw data before it was delivered in the raw file. In later discussions, he told me that he thought the same might be so of Hasselblad digital cameras and PhaseOne digital camera backs.
I don't think so. Keep in mind that the back can be exchanged in Hasselblad and Mamiya MF cameras and that third party backs are or were available (for example from Sinar). Third party backs typically do not have access to lens data, so the correction is manual. I do not think that there are obvious differences in lens profiles between the ones used for the manufacturer backs and the ones used for third party backs.
Reply With Quote
  #3  
Old October 9th, 2015, 07:20 AM
Doug Kerr Doug Kerr is offline
Senior Member
 
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,487
Default

Hi, Jerome,

Quote:
Originally Posted by Jerome Marot View Post
I don't think so. Keep in mind that the back can be exchanged in Hasselblad and Mamiya MF cameras and that third party backs are or were available (for example from Sinar). Third party backs typically do not have access to lens data, so the correction is manual. I do not think that there are obvious differences in lens profiles between the ones used for the manufacturer backs and the ones used for third party backs.
Makes sense, at least with respect to third-party backs..

Thanks.

Best regards,

Doug
Reply With Quote
  #4  
Old October 9th, 2015, 12:27 PM
Doug Kerr Doug Kerr is offline
Senior Member
 
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,487
Default

This is to refine my earlier observations, based on further enlightenment from Sandy McGuffog:

(Just to clarify this) In no Leica cameras is an adjustment for lens geometric distortion applied to the raw data as delivered.
Doing so would be gravely problematical, owing to interpolation issues.
In the Leica M-series cameras, no opcodes to control correction of geometric distortion during raw development are included in the raw (DNG) files.
This is in large part due to the fact that when the overall plan of lens corrections for the M-series cameras was established, the DNG file format at that time did not accommodate opcodes.
In (for example) the Leica Q-series cameras, opcodes to control correction of geometric distortion during raw development are included in the raw (DNG) files (assuming that the lens is recognized by the camera and the user has not turned off lens recognition).

My understanding is that the way to provide correction of lens geometric distortion for the Leica M-series cameras (as for many other) during raw development in Photoshop/ACR or Lightroom is to rely on a lens correction profile (LCP) (perhaps constructed by the user if a suitable one is not available elsewhere, maybe included with one of those programs).

Best regards,

Doug
Reply With Quote
  #5  
Old October 10th, 2015, 02:07 PM
scott kirkpatrick scott kirkpatrick is offline
Member
 
Join Date: May 2006
Location: Jerusalem, Israel
Posts: 409
Default correcting color casts vs correcting distortion.

I would certainly trust Sandy's information, and supplement with some things that I have turned up from experimenting, mostly with Leicas using Phase One's Capture One software, and with Olympus's latest cameras.
The color cast probem bedevilled the M8 and M9, and was a source of many firmware updates. In the M8 firmware, which was not encrypted, you could read large tables in which the corrections for color shifts were placed. These are used when writing out the compressed DNG files. The problem of color casts is known to occur in digital backs from Phase One and others when used with wide angle lenses. A procedure called LensCastCorrection, involving shooting through a white diffuser and saving the image so that a correction can be applied to subsequent shots with the same lens, aperture, and focal distance is provided in Capture One for this problem. Sandy's CornerFix program does this for the rest of us, fixing vignetting as well as color shifts.

Barrel/pincushion distortion comes next. In classic Zeiss and Leica lenses (probably CaNikon's best as well), this rarely exceeds 1-2%, so it is hardly noticeable, but in the recent wave of mirrorless EVF cameras, it seems very common to simplify the lens cost and construction by leaving this correction to software. An example is the very highly regarded Panasonic/Leica 25mm Sumilux which if left uncorrected seems to have about 7-10% barrel distortion. But the Exif somewhere contains instructions on the amount of correction needed. In Capture One you see this explicitly. Open the DNG file in the Crop tool. A black band at the edge shows the area in which some distortion has been removed, in case you want to start your crop by leaving this out. A lens profile (there are about 20 of them for m43 lenses) is set by default to take this all out, leaving a pincushioned edge of the corrected frame, which must be cropped. You can reduce of eliminate the correction if you wish, getting more pixels in the image, and possibly better detail resolution in the corners and sides.

scott
Reply With Quote
  #6  
Old October 11th, 2015, 05:33 PM
Doug Kerr Doug Kerr is offline
Senior Member
 
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,487
Default

Hi, Scott,

Thanks you for this valuable addition to our knowledge of this matter.

Quote:
Originally Posted by scott kirkpatrick View Post
I would certainly trust Sandy's information, and supplement with some things that I have turned up from experimenting, mostly with Leicas using Phase One's Capture One software, and with Olympus's latest cameras.
The color cast probem bedevilled the M8 and M9, and was a source of many firmware updates. In the M8 firmware, which was not encrypted, you could read large tables in which the corrections for color shifts were placed. These are used when writing out the compressed DNG files. The problem of color casts is known to occur in digital backs from Phase One and others when used with wide angle lenses. A procedure called LensCastCorrection, involving shooting through a white diffuser and saving the image so that a correction can be applied to subsequent shots with the same lens, aperture, and focal distance is provided in Capture One for this problem.
Aha!

Quote:
Sandy's CornerFix program does this for the rest of us, fixing vignetting as well as color shifts.

Barrel/pincushion distortion comes next. In classic Zeiss and Leica lenses (probably CaNikon's best as well), this rarely exceeds 1-2%, so it is hardly noticeable, but in the recent wave of mirrorless EVF cameras, it seems very common to simplify the lens cost and construction by leaving this correction to software. An example is the very highly regarded Panasonic/Leica 25mm Sumilux which if left uncorrected seems to have about 7-10% barrel distortion. But the Exif somewhere contains instructions on the amount of correction needed.
Are we sure this is in the Exif metadata (as distinct from, for example, by way of opcodes or something in the DNG file proper - I assume we are speaking of cameras in which the raw data comes in a DNG file)?

Quote:
In Capture One you see this explicitly. Open the DNG file in the Crop tool. A black band at the edge shows the area in which some distortion has been removed, in case you want to start your crop by leaving this out. A lens profile (there are about 20 of them for m43 lenses) is set by default to take this all out, leaving a pincushioned edge of the corrected frame, which must be cropped. You can reduce of eliminate the correction if you wish, getting more pixels in the image, and possibly better detail resolution in the corners and sides.
Very interesting. Thanks again for this insight.

Best regards,

Doug
Reply With Quote
  #7  
Old October 11th, 2015, 05:56 PM
Doug Kerr Doug Kerr is offline
Senior Member
 
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,487
Default

Hi, Scott,

The closest I have to a Leica camera is my Panasonic DMC-FZ1000. Its permanent lens has a really large (some would say revolting) focal length range - 25-400 mm ff35 equivalent.

If I open a raw file from this camera (not a DNG file - rather an RW2 file) in a raw developer that does not "know" this camera (except for enough to read its raw files), especially for shots taken at the "wide" end of the focal length range, we can see the rather severe geometric distortion.

But if I open the raw file in Silkypix Developer Studio, the "official" raw developer for this camera (although I have the "general use" version, for which this camera is listed as "supported"), I see an image essentially free of geometric distortion. I believe that this is done per tables that are part of the application, "called up" based on the identity of the camera (and thus by implication its lens) that is indeed carried in the Exif metadata.

I don't think I have the option to decline this operation (but I am not sure).

Best regards,

Doug
Reply With Quote
  #8  
Old October 12th, 2015, 11:36 AM
Doug Kerr Doug Kerr is offline
Senior Member
 
Join Date: May 2006
Location: Alamogordo, New Mexico, USA
Posts: 8,487
Default

Nothing really new or surprising here, but just to complete the thought . . .

Here we see a raw file from my Panasonic DMC-FZ1000 opened in RawTherapee (this is a screen shot of the preview image), with no lens distortion correction profile invoked:


This shot was taken with the lens at minimum focal length ("full wide-angle"). We see the ample geometric distortion. (Sorry I didn't have a grid chart or a wall full of bricks to shoot, but you can get the idea from this shot of part of my office.)

Here see the same file opened in Silkypix Developer Studio (again a screen shot of the preview image), with the "library" lens corrections for this camera applied:


The manual for Silkypix intimates that one can disable these corrections, but the explanation is confusing (the manual is in Japlish, to some extent) and I haven't yet be able to do that.

Best regards,

Doug
Reply With Quote
Reply

Bookmarks

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
Canon EOS Autofocus - BFCV and micro-adjust (MA) Doug Kerr Imaging Technology: Theory, Alternatives, Practice and Advances. 11 November 14th, 2011 02:44 PM
Eyeglass lenses and "vertex power" Doug Kerr Imaging Technology: Theory, Alternatives, Practice and Advances. 0 November 10th, 2010 06:47 AM
Lens MTF and resolution Doug Kerr Imaging Technology: Theory, Alternatives, Practice and Advances. 3 October 16th, 2010 06:36 AM
Understanding and selecting lenses Rhys Sage Layback Cafe 13 September 13th, 2008 08:47 AM


All times are GMT -7. The time now is 09:55 PM.


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!