digiKam

Professional Photo Management with the Power of Open Source

Correct Lens Distortion with digiKam

by Dmitri Popov

lenfuntool

Lens distortion is a fact of life. You can mitigate this problem, but you can’t avoid it completely (unless you are willing to invest in seriously expensive professional-grade lenses, that is). Fortunately, digiKam provides a set of tools that can help you to fix lens distortion with relative ease. In fact, the application sports the Auto-Correction feature that attempts to fix lens distortion with a minimum of tweaking. Continue to read

I really like the idea of the

I really like the idea of the lens distortion correction plugin, but it seems that the included lensfun database is too small - most of the lenses I use (in particular some popular Canon EF-S lenses and Sigmas) and also my camera (Canon 7d) are missing. It seems that this database is not updated any more. Is there an easy way of adding the relevant data about new lenses/cameras?

LensFun Database update tutorial...

Please take a look to LensFun Project tutorial to know how to add your lens data to database:

Lens Fun Database Update Tutorial

The lens distortion tool is

The lens distortion tool is fantastic, but it would be even better if:
-There was a plugin to assist with the lens calibration
-If the lens auto-correction was available for batch processing

I will be trying to add profiles for EF 70-300mm F4-5.6 IS, and EF-S 17-85mm F4-F5.6 IS, but once I do so, how can other digikam users benefit? Wait for a new lensfun release? Shouldn’t it be easier to update the lens profiles (e.g. like GHNS)?

About batch processing…

>-If the lens auto-correction was available for batch processing

I’m working on currently. It will be available for next digiKam 1.5.0 release.

digiKam

I’m working on currently. It

I’m working on currently. It will be available for next digiKam 1.5.0 release.

Fantastic! I have over 1000 photos from a trip to Kenya, most of which need correction (EF 70-300 F4-5.6 IS isn’t bad, but has noticeable distortion near the 300mm end).

And it’s done in trunk (1.5.0)

digiKam-lensfuntools

It cannot be a plugin…

>-There was a plugin to assist with the lens calibration

It’s a tiedous subject. A dedicated application need to be written for that. It’s not only around digiKam but all photo world.

digiKam

I will be trying to add

I will be trying to add profiles for EF 70-300mm F4-5.6 IS, and EF-S 17-85mm F4-F5.6 IS

When starting to do this (starting with EF-S 17-85, as I already had some panorama sets), I noticed that there was already an entry for the EF-S 17-85mm F4-F5.6, but the Digikam (1.3.0) Auto-Correction doesn’t list it. My version (0.2.4) of lensfun has a number of EF-S lenses listed in /usr/share/lensfun/slr-canon.xml, but the only one listed in the Digikam Lens drop-down is the EF-S 55-250 f4-5.6 IS, however, in slr-canon.xml, this lens is tagged as having a EF mount. So, none of the lenses that have <mount>EF-S</mount> are listed. Editing the lensfun definition for the EF-S 17-85mm to make the mount ‘EF’ results in it being listed in Digikam.

Is this a digikam bug, or a lensfun bug (so I can file a bug to the appropriate software)?

Thanks for your work on this fantastic software.

sound like a LensFun bug…

…because, we take lens list through LensFun api as well…

digiKam

Fixed in lensfun 0.2.5

It turns out the problem was that up to lensfun 0.2.4, many of the entry-level Canon DSLR’s were identified as having EF mounts, not EF-S mounts. Although not listed in the changelog (which I looked at previously to see if it was worthwhile upgrading), this is fixed in 0.2.5.

Of interest to Mandriva users, I have sent 0.2.5 to main/backports for 2010.1, so you can upgrade lensfun by running urpmi.update ‘Main Backports’ && urpmi –searchmedia Backports lensfun. I will consider backporting digikam 1.4.0 as well …

Upgrade lensfun to 0.2.5

Lensfun 0.2.4 had incorrect listings for some Canon DSLRs, listing their mounts as EF instead of EF-S. Cameras listed as EF will only show EF lenses, while cameras tagged as having EF-S mounts will list EF and EF-S lenses, so on 0.2.4, you would probably only see one incorrectly tagged EF-S lens (55-200mm).

Upgrade to 0.2.5, and this is fixed, and the 7D is also present in 0.2.5.

If your lens still isn’t listed in digikam, check in the lens profile files first (on my installation this is /usr/share/lensfun/slr-canon.xml), and ensure that it has the correct mount type listed etc. If it is missing, you’ll need to do the calibration.

/me proceeds with EF 70-300 f/4-5.6 IS calibration

I wonder why digital camera

I wonder why digital camera lenses aren’t optimized for things like contrast and brightness instead of absence of aberrations. There is plenty of CPU power available to correct images nowadays. Heck, there could be algorithms (or coefficients for a standard algorithm) stored in the lenses that are fed to the camera CPU/DSP to correct any trivial aberrations and other errors right there.
Can anybody guess why such a system hasn’t happened yet?

Comparing image quality

Comparing image quality (pixel sharpness etc) it is more important than the possibilities to correct brightness and contrast later.

What we really would need is very dynamic ranged imaging sensors for cameras. So that they could give now more like +/- f:2 dynamic. Just too bad that D/A conversion is still so bad.

Autodetection of Canon

That´s a really great plugin, thank you for it!

I played a little bit with this filter. The resulting picture looks much better than without the filter.

But I´ve found a little problem for me, using a Canon EOS 450D. The autodetection of the lens does not run.

I searched a little in the source files. And I found, that for Canon the “Lens”-Tag is used for the lens-search. I think, it would be better to use the “LensType”-Tag. I changed this in “dmetadata.cpp” and compiled it for me and now all works great for my lenses and me.

send me a patch

Great. Please send me a patch of your changes. I will include it later.

Thanks in advance

sending adress

Where can I send the patch to?

bugzilla

open a new file in bugzilla, into digiKam section. take a look here

digiKam

Patch added in bug 251920

Since I didn’t find a bug about this when searching on bko, I patched and tested for myself on 1.4.0. After verifying that it works correctly (with Canon EOS 500D, I may be able to test with images from a 7D a bit later), I filed bug 251920 with the trivial patch.