Bug #9999

TCA correction does not work until you choose a lens

Added by YAFU YAFU almost 6 years ago. Updated almost 6 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
Affected Version:
git development version
hardware architecture:


After trying for a long time and I think that TCA correction did not work, I realized that I had to first select a lens to TCA correction has effect. My camera has no lens profiles for LensFun, but if I choose a generic lens, then TCA correction works very well.
In UFRaw the chromatic aberration correction can work without its being necessary to choose a lens. Maybe Darktable could work in the same way.
Using Darktable 1.5+1286~ged22281 on Kubuntu 14.04.

lensfun-broken-tca-changed.patch (1.85 KB) lensfun-broken-tca-changed.patch Pascal de Bruijn, 08/22/2014 07:41 PM

Related issues

Related to darktable - Feature #9273: lens correction enhancement - more understandable interfaceNew02/18/2013


#1 Updated by Christian Kanzian almost 6 years ago


If you are looking for general CA correction, you could use the Chromatic aberrations modul:


#2 Updated by YAFU YAFU almost 6 years ago

Hi Christian, thanks.
I had discussed this in the IRC channel. Chromatic aberrations module does not seem to do much on the kind of chromatic aberrations of my photos. On IRC I had shared some examples before I realize that TCA correction really worked on Darktable, but it was necessary first to choose a lens for TCA correction take effect. This is the link of the samples (press Slow Download button):

#3 Updated by Christian Kanzian almost 6 years ago


Sorry I didn't know that. So this sounds more like a feature request "Use TCA correction for not supported lenses". As workaround you could maybe create a fake lens entry in the lensfun library - can be in your path - so that you don't need to select a general lens by hand. The best of course would be to calibrate it.


#4 Updated by Torsten Bronger almost 6 years ago

There is already a "generic lens" in Lensfun. However, this is not obvious and inconvenient.

#5 Updated by Pascal de Bruijn almost 6 years ago

So I've briefly looked into this issue...

When you switch to manual TCA correction in UFRaw, it seems UFRaw synthezis a generic lens:

char *lens_model = g_strdup_printf("Generic, Crop factor %.4g",

Which turns into something like "Generic, Crop factor 1.5", which matches the "Generic, Crop factor 1.5 (APS-C)" lens in the lensfun database because UFRaw does fuzzy matching IIRC.

Now in Darktable this won't work since we don't do fuzzy matching (as we want to avoid accidental lens matches and inadvertant invalid corrections). I've attached a (quasi-broken) patch which should implement a similar heuristic to lensfun, but it's not working properly, and would require further work to become functional and may very well require changes on lensfun's side as well.

To mitigate the usability side of the issue somewhat I've disabled the TCA sliders when they are non-functional:

It's not quite ideal, but slightly better still.

#6 Updated by Pascal de Bruijn almost 6 years ago

Actually I've extended this to the entire lens correction module user interface:

#7 Updated by Torsten Bronger almost 6 years ago

One should be able to perform manual TCA correction by making up a lens and a modifier object. The following snippet is probably non-working and possibly not even valid C, but it may get the idea across:

lens = lf_lens_new();
lens.crop = 1;
lens.aspect_ratio = 1;
struct tcac = {LF_TCA_MODEL_LINEAR, 1, [red_slider, blue_slider]}
lf_lens_add_calib_tca(lens, &tcac)
modifier = lf_modifier_new(lens, 1, width, height);
lf_modifier_initialize(lens, format, 1, 1, 1, 1, targetgeom, LF_MODIFY_TCA, false);

#8 Updated by Roman Lebedev about 5 years ago

  • Related to Feature #9273: lens correction enhancement - more understandable interface added

Also available in: Atom PDF

Go to top