8
\$\begingroup\$

Olympus micro 4/3 cameras apply distortion correction on their in-camera JPEGs when used with a micro 4/3 lens. Panasonic cameras correct both distortion and chromatic aberration with their lenses.

Although I'm not sure where this information is stored, since this also works on the off-camera software I'd guess that it's in metadata attached to the RAW images.

Is this format documented anywhere (either officially or through reverse-engineering)? It would be nice to be able to implement this correction in open-source software (specifically lensfun) without needing to either calibrate the lens or rely on the calibration database.

EDIT: to make this perfectly clear - the objective is to take the RAW file from the camera and be able to apply the same correction that the in-camera JPEG gets, or that gets applied by the Olympus software.

\$\endgroup\$

5 Answers 5

4
+50
\$\begingroup\$

There appears to be a pretty rich Open Source movement in the Linux community to generate raw file format processors for linux. I've found several wiki's that are working on compiling file format details for known RAW formats, and there are a few applications that contain some code. Some formats, like Canon's .CRW and .CR2, are open specifications and you can find the details online. It seems that the .ORF format (or the Panasonic .RAW format) are not open, so the only thing knowledge that can be gleaned is via reverse engineering. I doubt that the information you are looking for is contained within EXIF data, however if it is stored, it should be available in RAW format metadata. Here are some resources:

The bulk of a RAW file format is a direct sensor data dump, either from a Bayer array, CCD, or possibly a layered CMOS (like the Foveon.) That makes the image data pretty easy to spot, as it is very patterned. The data you are interested in will likely be more complex and and random, either stored at the beginning or possibly the end of a file format. I've done a fair amount of file format reverse engineering in my day, and may be able to recognize some structure in the .ORF format for you. (I worked on an editor for Sim City 4 and the Sims 2 a number of years ago, and alongside a few others, we must have decoded some 300+ file formats via HEX. I may be able to help provide some insight if I can get a hold of some .ORF raw files from the camera+lenses you have access to.) Your best bet, if you wish to have support for lens correction added to lensfun, would be the open source movements to bring RAW processing to Linux.

UPDATE:

Alternatively, it seems like Adobe has released a Lens Profile generator that can generate lens profiles for Lightroom 3/ACR. They cover geometric distortion, chromatic aberration, and vignetting. I know you mentioned something that could be used with the program lensfun, but this might be a viable alternative.

\$\endgroup\$
10
  • \$\begingroup\$ I had a look at the open Adobe DNG format, and that contains a bunch of tags for these kinds of off-camera correction. Sadly, running a ORF through Adobe's DNG converter doesn't populate these fields, or I'd be done! As for Adobe's Lens Profile Creator, that might be interesting as a more friendly (and widely used) calibrator + online repository of lens profiles, but the lensfun library already has a database of lens profiles generated using Hugin. My goal is to make the profile creation unnecessary for µ4/3s lenses, since they've got it built in (somewhere!). \$\endgroup\$
    – RAOF
    Commented Aug 15, 2010 at 23:31
  • \$\begingroup\$ The lens profile format for ACR/Lightroom might be easier to crack than the .ORF raw file format. You might try creating some profiles for your lens, and see if you can extract that information instead. \$\endgroup\$
    – jrista
    Commented Aug 16, 2010 at 18:29
  • \$\begingroup\$ Of course, reverse engineering is possible, but hardly the answer to the question. \$\endgroup\$ Commented May 23, 2014 at 12:34
  • \$\begingroup\$ @bronger: Actually, it does answer the question, as best as was possible at the time. The OP asked for documentation, and indicated the goal was to ultimately implement lens correction functionality in OSS. The information I provided was the best information available FOUR YEARS ago. I think your downvote is unwarranted and your comment missed the point of the question. \$\endgroup\$
    – jrista
    Commented May 23, 2014 at 17:08
  • \$\begingroup\$ The point of documentation is to avoid reverse-engineering. \$\endgroup\$ Commented May 26, 2014 at 8:48
4
\$\begingroup\$

At least Panasonic cameras store lens correction information in the raw files. Some preliminary results of reverse-engineering the relevant exif fields can be found on http://syscall.eu/#pana.

The distortion correction information is stored in the 0x119 tag, and consists of 16 16-bit integers, the meaning of which is decoded in the linked post. The chromatic aberration information is stored in the 0x011b tag, which has not yet been investigated.

\$\endgroup\$
1
\$\begingroup\$

It also could be part of the lens-body handshake. Not sure how the desktop software would know the information though. How are you determining that the off-camera software can do the correction?

I know Adobe has some sort of public lens correction stuff for Lightroom 3, perhaps you might have better luck reverse-engineering that stuff.

\$\endgroup\$
2
  • \$\begingroup\$ dpreview.com/articles/distortion/page2.asp gives some details. It seems that Adobe Camera Raw also picks up this information in the raw files. \$\endgroup\$
    – RAOF
    Commented Aug 10, 2010 at 0:23
  • 1
    \$\begingroup\$ Note that the data is included in the RAW files, not the JPEGs. I think you are out of luck if you are looking at JPEGs, as those will already be corrected. \$\endgroup\$ Commented Aug 10, 2010 at 19:33
1
\$\begingroup\$

It's not stored in the Exif - the correction is automatically applied to Jpeg images.
The Olympus raw format contains a simple (4 ?) parameter matrix for lens correction for regular lenses - this is only for the higher end models and is only populated by the pro series cameras.

The corrections for the Adobe software are generated by Adobe testing lenses themselves - tit doesn't use the manufacturers values.

Sorry don't know about the micro 4/3.

\$\endgroup\$
0
\$\begingroup\$

I would guess only lens data is stored in EXIF, the correction amounts are hardcoded to both camera firmware and the post-processing software and not included in EXIF.

\$\endgroup\$
3
  • \$\begingroup\$ I guess that's possible; it seems a stupid way to do it, though. Particularly since my Panasonic lens gets corrections applied on my Olympus E-PL1 body (and I believe the reverse is true - Olympus lenses get corrected on Panasonic bodies). It would require both a software and firmware upgrade each time a new µ4/3 lens was released by anyone. \$\endgroup\$
    – RAOF
    Commented Aug 9, 2010 at 6:40
  • \$\begingroup\$ @RAOF: It may not necessarily require a firmware update. A flexible lens specification format can be created that allows lenses to define their distortions, and a single piece of software can apply the correction processing based on such a specification. That is essentially what Adobe Lightroom 3 does with its new camera lens profiles. If each lens contained its specification, you wouldn't need to update firmware for each lens...attaching a lens is enough, as it would tell the firmware what its correction factors are. \$\endgroup\$
    – jrista
    Commented Aug 13, 2010 at 6:28
  • \$\begingroup\$ Right - those correction factors (+ the specific algorithm used) are what I'm looking for! \$\endgroup\$
    – RAOF
    Commented Aug 14, 2010 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.