Closed assaft closed 10 years ago
All the metadata is copied from the input files to the output DNG, using Exiv2 (http://exiv2.org/). Some metadata is standard, while other is proprietary and depends on the maker. If Exiv2 is able to detect this metadata (called the "Makernote") for your camera maker and model, there should be no problem. However, I have seen at least one Olympus camera that declares to be made by Ricoh (who bought Olympus some years ago). This fact misleads Exiv2 until v0.24 (it should be fixed in the latest development snapshot) and the Makernote is not copied. Maybe you are experiencing a similar problem. Can you send me an example picture, or tell me your camera maker and model?
Thanks for the quick reply. It's an Olympus E-M10.
I prepared a zip file with an example: https://dl.dropboxusercontent.com/u/21642925/rawfiles.zip It contains:
B. When running dng_validate -v it shows: Parsing OpcodeList3: 1 opcode
Opcode: WarpRectilinear, minVersion = 1.3.0.0, flags = 0 Planes: 3 Optical center: h = 0.498276 v = 0.500000 Plane 0: Radial params: 1.000000, -0.099675, 0.025612, -0.005231 Tangential params: 0.000000, 0.000000 Plane 1: Radial params: 1.000000, -0.100233, 0.026256, -0.005319 Tangential params: 0.000000, 0.000000 Plane 2: Radial params: 0.999999, -0.100157, 0.027315, -0.005481 Tangential params: 0.000000, 0.000000
This indicates that the DNG contains information for correcting lateral chromatic aberrations and I assume that also distortion information. A text file is included with this information.
As far as I know the opcodes are some sort of extension in the DNG file format. See page 16 in DNG Spec 1.4.0.0.pdf.
Let me know if there's anything else I can help with.
Thanks!
A workaround to this issue would be to convert the bracketed RAW files to DNG using Adobe's DNG Converter and then to use HDRMerge for merging them into a new DNG. This would utilize Adobe's tool for decoding the lens correction data from the proprietary RAW files and encoding this data into DNGs.
However, I tried this workflow and it doesn't work. I converted a group of ORF files using Adobe DNG Converter and verified (by dng_validate.exe) that the generated files have the lens correction information (i.e. the opcodes). When I merge them in HDRMerge I get a DNG that doesn't have the opcodes and not being corrected when opened in Lightroom.
I have some more info to give.
My goal was to find how to add the lens geometry correction data to a DNG file that HDRMerge produces.
Preliminary steps:
At this point I started to look at the differences between these two DNG files. exiv2 was used to print all tags. This indicated that merge.dng is missing the tag Exif.SubImage1.OpcodeList3 - which is known to contain the lens correction information. This is the root of the problem.
To verify that, I tried to add the OpcodeList3 tag manually using exiv2. However, exiv2 did not support addition of such tag (explanation below) so first I had to alter its code and to rebuild it. I then added the missing tag and verified that now the DNG is opened in Lightroom with the lens geometry corrected.
Regarding the limitation of exiv2:
The upshot of this is that in order to preserve the lens geometry correction, HDRMerge needs to copy the tag Exif.SubImage1.OpcodeList3 from one of the input DNGs to the DNG that it produces. This can be done using exiv2 once it is patched.
Attachments:
To download: https://dl.dropboxusercontent.com/u/21642925/LensCorrectionTag.ZIP
Additional notes:
Nice research! Using it, I found a workaround that allows me to copy the OpcodeList tags from the source DNG files to the merged DNG:
I will mark this as fixed, although just copying the OpcodeList tags if they already exist is not a perfect solution. However, calculating the lens correction information from the maker metadata is way too complex. I could do it easily with the DNG SDK, but linking against it is a Total Pain In The Neck for serveral other reasons, so it is not an alternative.
Thanks. Nice solution. Some comments:
I verified that it works in 0.5. Thanks.
Micro four thirds cameras embed a lens profile in their RAW files (ORF/RW2). When OEM converters / ACR open such a file, they correct the lens aberrations based on the information stored in the included profile.
I noticed that Lightroom doesn't correct the distortion of DNG files created by hdrmerge (from several ORF files). It could be because hdrmerge doesn't include the lens profile when merging several RAW files into a DNG. I believe that the profile values can be copied as is from the original RAW files but probably the profile should be encoded somewhat differently in the DNG container. It would be great if hdrmerge could support this.
Information on the location of the profile in RW2 files and about its internal components can be found here: http://syscall.eu/#pana