Rawtherapee: New attempt to integrate lensfun

Created on 14 Apr 2017  Â·  28Comments  Â·  Source: Beep6581/RawTherapee

I agreed with Alberto to make a new attempt to integrate lensfun

Todo:

  • [ ] ensure that we can build rt with lensfun on all platforms. In first step without functionality.
  • [ ] collect raw files for tests. Maybe this is helpful.

to be continued. Alberto and others, feel free to edit the todo list

enhancement

Most helpful comment

Hi, I am a lensfun developer and happy to see that you plan to integrate lensfun support in RT. If you experience problems with compilation, or any other issues appear, feel free to contact us.

All 28 comments

I uploaded some raw files for tests.
@Beep6581 Can you please create a new lensfun folder in shared/test_images and copy the raws into that folder?

@heckflosse Ingo, thanks for opening this. I think that besides the
technical part about compiling (necessary of course), we should think about
the user interface. from my understanding, lensfun provides support for
correcting all kinds of lens distortions that are currently available in
RT, but it does things differently from the methods available now in dev. I
think we should not try to "force" lensfun to operate in the RT way, but
instead offer it as an alternative to the current methods. from the user's
pov, I would propose that the lens correction section has two alternative
operating modes: the usual one (call it say "legacy") and the lensfun one.
for the latter, we can take inspiration from the UI of ufraw, which is
quite nice regarding this IMHO. what do you think?

@agriggio Alberto, thanks for contributing on this :+1:

I put the compiling part on top if the todo list because that was the part the last attempt of lensfun integration failed at the beginning.

I agree with you that we should not try to force lensfun to operate the RT way. It's just the opposite: lensfun will force us to go a different way.

Of course we should review the user interface. I just had a look at ufraw ui (which generally hurts my eyes) but for the lens correction part it's quite good. But i'm not a specialist in ui design. Getting inspiration from ufraw and/or dt ui regarding lens correction will not hurt :+1:

I would propose that the lens correction section has two alternative
operating modes: the usual one (call it say "legacy") and the lensfun one.

Maybe finally we will only have the lensfun one (because lensfun somehow can use lcp profiles) ;-)

@agriggio Alberto, lensfun has three corrections: Distortion, CA and vignetting. Looking at the list of supported lenses, distortion correction is the most important. For that reason (and because raw ca auto-correction is already quite good) I think we should put distortion correction on top of the todo for the corrections. Do you agree?

Ingo

agreed! from my brief look at lensfun, it seems to me that all corrections
have a similar API, so once distortion is done, the others might be easy.

regarding the current mode, I think a slightly enhanced auto-distortion
(which could work also non-interactively) would still be useful. also the
vignetting and CA corrections are quite easy to use, whereas I'm not sure
about the same for lensfun in "manual" mode. that's why I thought it could
be worth considering keeping the current mode as an option

I think a slightly enhanced auto-distortion (which could work also non-interactively) would still be useful

Absolutely! It's a good method to correct distortions in case no lens profile exists and the embedded jpg is corrected in camera and I would vote strictly against removing that method.
The problem to apply it in non-interactive mode is a performance-problem. If we want to apply it in batch-mode (from file browser) and want to see the distortion-corrected thumb immediately, it will slow down thumb generation (of course only for the files it's applied to). If we don't need to see the distortion corrected thumb immediately it's no performance-problem of course.

About the lensfun API: iirc we need a method to convert the representation of data in rt to the RGB(A) representation of data in lensfun and of course also backwards. This conversion has to be as fast as possible (maybe using some tricky SSE code as well). I will take this part if you don't mind.

@Beep6581 @Desmis @Floessie @Hombre57 @iliasg and everyone else:

If you have raw files for which good lensfun profiles exists please provide the raw files

@heckflosse the sse and openmp parts are all yours :-)
I also have RAWs that I can share, the Sony kit lens has huge distortion
and vignetting at the wide end, both corrected very well by lensfun

I'm not sure about understanding everything (reminder, I'm an old grumpy frenchman who speaks bad English) :
1) is it planned to use the library "lensfun", if yes how (I think I understand, this job is for Ingo )?
2) what is being done with the current "adobe lens"?
3) In fact, what are we looking for? Some software combine camera (Nikon D200, D300, D5 etc.) with the optical, others not?
What can be my (our) contribution? GUI, data, etc.

Jacques

hi Jacques, here are my comments:

  1. yes, the job is for Ingo and myself. but if someone​ else wants to
    contribute, let us know!

  2. we are still discussing this. my proposal is to keep both as alternative
    methods, with the Adobe marked as "legacy"

  3. what we are looking for: lensfun has some cool features that are now
    missing, like the support for change of projections. also, it has ways of
    auto detecting the camera/lens combination to apply corrections
    automatically. finally, sometimes it might have better corrections for some
    lenses (for example there was a very recent bug report about this on a
    compact canon camera)

Great to see this!

@Beep6581 Can you please create a new lensfun folder in shared/test_images and copy the raws into that folder?

Unfortunately I had to delete some files a few months ago because we were running out of space on the server. Could you instead use FileBin (upload a file once every 2 months to keep them alive forever) or Google Drive?

If you need raw files, there is RPU: https://raw.pixls.us/

Update: I made space on the server. If you would still like me to upload the file from filebin to the server, please confirm and I will do so.

Thanks to @Beep6581 my test files are available now at http://www.rawtherapee.com/shared/test_images/lensfun/

I just managed to access lensfun on Win7/64 builds but it's a still bit complicated... I'll report later

Hi, I am a lensfun developer and happy to see that you plan to integrate lensfun support in RT. If you experience problems with compilation, or any other issues appear, feel free to contact us.

@seebk Great! I just opened an issue

The version downloaded from github/lensfun master branch is said to be 0.3.2.0 when I try to build (with same error as Ingo).
The version available on Msys2 is 0.3.2-2. what is the meaning of the appended -2? is it possible to know the corresponding commit?
I doubt that the msys2 version is more recent than the one obtained on github!
Is this MSYS2 version usable or shall we have to build from github to get an up to date version?

@gaaned92 I would prefer to build from github/lensfun master branch. This way we can ensure that we use almost the same lensfun version on all platforms during our work.

@heckflosse

The problem to apply it in non-interactive mode is a performance-problem.

as long as you only pay for what you use, I don't see this as a big problem. the current situation has a very big drawback, that you can't put the auto correction flag in a pp3 to use as a preset. this severely limits its usefulness imho. if there are no objections, I'd like to change this behaviour. if performance turns out to be really a problem for batch mode, we can consider how to fix that later. what do you think?

@agriggio I agree :+1:

BTW please note that the main git repository of Lensfun is at sourceforge
and the github repository is just a fork.

@seebk Thanks for the information. It was in fact unclear to me where the main repository resides.

Just a heads-up: I've started working on this. I hope to have some usable prototype in a reasonable time... (nothing more specific yet :wink: )

just pushed branch lensfun. Basic integration done. Only distortion correction "kind-of works", but there is no GUI yet. If you are interested in testing, and want to know what I mean by "kind-of works" here, ask me :stuck_out_tongue_winking_eye:

implemented by merging #4070

@agriggio I updated coverity: https://scan.coverity.com/projects/rawtherapee

thanks! I had a (very) quick look but didn't notice anything strange

Was this page helpful?
0 / 5 - 0 ratings

Related issues

agriggio picture agriggio  Â·  4Comments

Hombre57 picture Hombre57  Â·  3Comments

Beep6581 picture Beep6581  Â·  4Comments

JIPG2 picture JIPG2  Â·  3Comments

elecprog picture elecprog  Â·  5Comments