DNG file missing lens EXIF metadata - General Help and Assistance on using CHDK stable releases - CHDK Forum

DNG file missing lens EXIF metadata

  • 8 Replies
  • 6958 Views
DNG file missing lens EXIF metadata
« on: 14 / June / 2010, 05:27:12 »
Advertisements
I have been using an Canon DIGITAL IXUS 70 running CHDK for years now. CHDK is an amazingly versatile piece of software that makes this camera so much more flexible. Shooting DNG is a dream come true.

These past few days, I have been playing with the current 0.9.9 CHDK release and the "Adobe Lens Profile Creator" to correct lens distortion on this tiny point-and-shoot camera. The JPEG workflow was up and running in no time, but the DNG workflow took me two days to get working.

After a lot of digging and trying things out I found that the lens EXIF metadata entry is missing. This is why Lightroom 3 does not find the correct profile for the cam. After using exiftool to copy the exif metadata from a JPEG version of a photo to the DNG for all the photos involved (calibration images and images I want to fix the distortion for) everything works.

Lightroom isn't smart enough to detect that this cam has a fixed lens (which is in the metadata, too) and only one lens profile can ever make any sense on this cam. So this is also in part the fault of Lightroom.

My question is: "Why is this metadata entry missing from the DNG?" Are there technical limitations at play or is there something that can be done to fix this?

There are other pieces of metadata missing from the DNG versions. To illustrate I have attached the output from exiftool for a pair of images.

Please feel free to ask me any questions that might help to improve this issue.

*

Offline fe50

  • ******
  • 3152
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Re: DNG file missing lens EXIF metadata
« Reply #1 on: 15 / June / 2010, 01:19:52 »
Hello & welcome, g3power !

"Why is this metadata entry missing from the DNG?" Are there technical limitations at play or is there something that can be done to fix this?
When the DNG support was added to CHDK, only some of the most common EXIF data values were used...
We could add more data into the header, it's not a technical limitation, but somebody have to code/progamm this...
Since the JPEG file already includes all possible values, adding more EXIF fields was not necessary until now; furthermore the free memory (RAM) on some of the cameras is very limitied...

Re: DNG file missing lens EXIF metadata
« Reply #2 on: 15 / June / 2010, 14:40:08 »
Hello & welcome, g3power !
Thanks!

When the DNG support was added to CHDK, only some of the most common EXIF data values were used...
We could add more data into the header, it's not a technical limitation, but somebody have to code/progamm this...
Since the JPEG file already includes all possible values, adding more EXIF fields was not necessary until now; furthermore the free memory (RAM) on some of the cameras is very limitied...
So you are saying that I have to take care of this myself, right? I will have to look into setting up a build environment on Mac OS X then. A quick search didn't bring any light into how to go about this. Maybe I missed something.

As an aside: is there a reason for some of the parameters having slightly different values in the two versions of the same photo?

*

Offline fe50

  • ******
  • 3152
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Re: DNG file missing lens EXIF metadata
« Reply #3 on: 15 / June / 2010, 15:23:27 »
The interesting code should be in dng.c and dng.h.
I've never used a gcc build env under Mac OS, it may be more complicated with Mac OS than with Windows or Linux...

You'll find the needed informations & links here: http://chdk.wikia.com/wiki/For_Developers

Maybe you want to go the simple way with the CHDKShell under Windows (using BootCamp ?):
- download & expand the tool, run it;
- let the CHDKShell load the current source code, select your camera & your compile options
- compile; now you have a working dev environment, edit the source code etc.

As an aside: is there a reason for some of the parameters having slightly different values in the two versions of the same photo?
Which values ?

Re: DNG file missing lens EXIF metadata
« Reply #4 on: 16 / June / 2010, 02:55:53 »
Which values ?
I could list them here, but doing a diff on the files I have provided probably is much more readable.

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: DNG file missing lens EXIF metadata
« Reply #5 on: 16 / June / 2010, 03:21:15 »
-deleted post-

*

Offline whoever

  • ****
  • 280
  • IXUS950
Re: DNG file missing lens EXIF metadata
« Reply #6 on: 16 / June / 2010, 04:13:07 »
I found that the lens EXIF metadata entry is missing.
Have you found out exactly what kind of entry you're missing? As I'm afraid that neither EXIF nor DNG metadata specification (they are not the same, by the way) provides a generic entry of this sort. Your Exiftool output actually contains a mixture of standard EXIF data and MakerNotes that is proprietary.

Incidentally, yours is not a fixed lens (= single focal length, in Adobe parlance), but a zoom lens, and the focal length (both absolute and 35mm-equivalent) is  included in the DNG metadata. Which, together with the camera model (it is there, too) should be sufficient to uniquely identify the image settings.

If you can figure out what additional DNG tags are needed for your workflow, you will likely get help here as to how to add them in dng.c.

Re: DNG file missing lens EXIF metadata
« Reply #7 on: 19 / June / 2010, 15:55:26 »
Have you found out exactly what kind of entry you're missing? As I'm afraid that neither EXIF nor DNG metadata specification (they are not the same, by the way) provides a generic entry of this sort. Your Exiftool output actually contains a mixture of standard EXIF data and MakerNotes that is proprietary.
The lens's name is missing from the dng's metadata.

Code: [Select]
Lens 5.8 - 17.4 mm

This is the culprit in my case. This fixes the issue:

Code: [Select]
exiftool -exif:all= -tagsfromfile %d%f.JPG -r -exif:all -overwrite_original_in_place -ext DNG /path/to/folder/to/process

Incidentally, yours is not a fixed lens (= single focal length, in Adobe parlance), but a zoom lens,
To me the lens is fixed. Fixed as in "I can't remove it." :) I am used to calling those lenses you refere to "prime". Sorry for not making that clear.

and the focal length (both absolute and 35mm-equivalent) is  included in the DNG metadata. Which, together with the camera model (it is there, too) should be sufficient to uniquely identify the image settings.
You are right, of course. It could be sufficient. But alas the people at Adobe didn't do it that way. They appear to require an entry for "lens" matching between the profile and the metadata.

If you can figure out what additional DNG tags are needed for your workflow, you will likely get help here as to how to add them in dng.c.
Thanks. It's just that as explained above I couldn't quickly figure out how to set up a dev environment for CHDK on Mac OS X. Otherwise I probably would have fixed this already. Without compiling a test build I would be fencing in the fog so to speak.

*

Offline whoever

  • ****
  • 280
  • IXUS950
Re: DNG file missing lens EXIF metadata
« Reply #8 on: 20 / June / 2010, 13:57:37 »
The lens's name is missing from the dng's metadata.
Code: [Select]
Lens 5.8 - 17.4 mm
This is the culprit in my case.
All right, that's the LensInfo DNG tag. Here's an excerpt from the specs:
   Tag: 50736 (C630.H)
   Type: RATIONAL
   Count: 4
   Value 0: Minimum focal length in mm.
   Value 1: Maximum focal length in mm.
   Value 2: Minimum (maximum aperture) f-stop at minimum focal length.
   Value 3: Minimum (maximum aperture) f-stop at maximum focal length.
   Usage: IFD0
   If the minimum f-stops are unknown, they should be encoded as 0/0.

It is indeed a useful info, and doesn't cost anything to include.

In dng.c, add the lines in red:

...
int cam_AsShotNeutral[]={1000,1000,1000,1000,1000,1000};
int cam_LensInfo[]={ 5800,1000, 17400,1000, 0,0, 0,0 };
...

...
 {0xC62E, T_RATIONAL,  1, (int)cam_LinearResponseLimit},
 {0xC630, T_RATIONAL,  4, (int)cam_LensInfo},

 {0xC65A, T_SHORT,     1,  cam_CalibrationIlluminant1},
...

That would do, if you were building only for yourself. To make it work for all other cameras, one needs a couple more lines of code, for instance like this:
...
 cam_AsShotNeutral[5]=wb[2];
 cam_LensInfo[0] = get_focal_length(-1);  // ShortFocal
 cam_LensInfo[2] = get_focal_length(0x100000);  // LongFocal
...

(Please note that I haven't checked any of these, just a quick impression.)

 

Related Topics


SimplePortal © 2008-2014, SimplePortal