Lensfun / ufraw lens correction profile for 17mm prime

squeegee

Mu-43 Veteran
Joined
Jan 26, 2010
Messages
403
For those of you who use lensfun or ufraw...

here's a lens profile for the m.zuiko 17mm prime :

Code:
<lens>
    <maker>Olympus</maker>
    <model>Olympus M.Zuiko Digital 17mm F2.8 Pancake</model>
    <mount>Micro 4/3 System</mount>
    <cropfactor>2.0</cropfactor>
    <calibration>
        <distortion model="poly3" focal="17" k1="-0.110" />
	<tca model="poly3" focal="17" br="-0.0002" vr="1.00045" bb="0.0003" vb="1.0002" />
    </calibration>
</lens>

just throw that in the slr-olympus.xml, also make sure you have

Code:
    <mount>
	<name>Micro 4/3 System</name>
    </mount>
    <camera>
	<maker>OLYMPUS IMAGING CORP.</maker>
        <maker lang="en">Olympus</maker>
        <model>E-P1</model>
        <mount>Micro 4/3 System</mount>
        <cropfactor>2.0</cropfactor>
    </camera>

in there as well.

All the info was submitted to lensfun so it should show up in the lens database in the future.

Incidentally if anyone else is trying to generate lens correction data using hugin... check the results. The distortion correction results it gave me were way too weak, by about a factor of 4, doing almost nothing... The TCA (chromatic aberration) correction numbers were about 4x too strong making the result worst than the original. I had to hand tweak the numbers to get something relatively sane and useful.

--- EDIT ---
After some discussion as per posts on here.
It appears UFRaw doesn't take the crop factor into account. As a result the numbers I posted above are wrong, but work for UFRaw. (which explains why my hugin numbers didn't work, they did, just not with ufraw)

The correct numbers should be as per Indigo's post :

<calibration>
<distortion model="ptlens" focal="17" a="0.00835" b="-0.04149" c="-0.0022" />
<tca model="poly3" focal="17" br="-0.0004492" vr="1.0016410" bb="0.0005749" vb="0.9989794" />
</calibration>
 

mauve

Mu-43 All-Pro
Joined
Mar 9, 2010
Messages
1,638
Location
Paris, France
Your post somehow had slipped below my radar. Congrats for this job, it's tremendously useful for many software besides Ufraw - digikam uses it too.

Cheers,
 

squeegee

Mu-43 Veteran
Joined
Jan 26, 2010
Messages
403
@squeegee

Can share with us how you did the data for your lens profile?

for the most part I followed their instructions :

Adding new lenses to the database

The numbers didn't come out very good though so I have to manually tweak them.

For the barrel distortion I ended up taking a picture of a grid on my monitor (kind if like the one you see on dpreview for showing barrel distortion) then tweaking the parameters till that became pretty much a perfect square.

The CA numbers, I ended up looking at the picture at 200% or so, and noticed the generated numbers were way too high, so I played around with those parameters till I understood which colour and direction was phased by which parameters and adjusted them so it was better. The centre almost always seemed fine regardless of the numbers it was the edge of the frame that was best to look at.

I had emailed the lensfun authors about this and they said the instructions/hugin generally work but for some unknown reason some lenses don't seem to work well so it's important to double check your results.

I think m43 users should make sure their lenses are in the lensfun library, make m43 the most comprehensively supported lens corrected system around :smile:

If we get a little practice, and get the routine down right, we could just get people to submit pictures to us and we could generate the lens profile from the raw pictures they take... It would streamline the process of supporting every single lens so most people wouldn't have to fuss with the process/numbers.
 

squeegee

Mu-43 Veteran
Joined
Jan 26, 2010
Messages
403
@squeegee

Is it posible you did enter the wrong crop value when you did go the way as sugested at the lensfun calibration pages?

Perhaps this thread is also usefull:

Flickr: Discussing Lensfun in Photivo

it's entirely possible I did something wrong... but some one would have to show me exactly what. I use a crop factor of 2 which it also auto detects, hugin works fine with in itself in that the panoramas it generates given the crop factor and other information are really good (It's night and day compared to the in-camera-panoramas I've seen).

I spent quite a few hours going through it all and went through the routine about 6 times to verify my results (the bad and good ones) so if there's an error, it's not from a typo but from my understanding of the inputs or workflow.

which lens are you generating the data for?
 

headlights

New to Mu-43
Joined
Mar 29, 2011
Messages
6
Ok so prolly indeed the hugin procedure goes just wrong on some lenses. Could the devs tell you why?

about the lens i am doing:
I hardly dare to say but it is for a nikon coolpix E3700 point and shoot with raw hack
 

squeegee

Mu-43 Veteran
Joined
Jan 26, 2010
Messages
403
Ok so prolly indeed the hugin procedure goes just wrong on some lenses. Could the devs tell you why?

about the lens i am doing:
I hardly dare to say but it is for a nikon coolpix E3700 point and shoot with raw hack

I asked but the developer didn't know why, I think it was more of a case of no one has bothered to check why since it's not a big problem.
 

headlights

New to Mu-43
Joined
Mar 29, 2011
Messages
6
It is a pitty always nice to know WHY something doesn't goes as planned. For sure with hard/software

I will post about my experiences when done. May take a few days I have time for it. I first need to shoot a few pics. I want to take them outside at about noon with a sunny sky to have best start. Now wether is bad so i have to wait a few days.

I plan to follow the Bibble tips Introducing Bibble 5
Then run the lensfun / Huggin procedure and ceck those results with Photivo, Bibble and Gimp. Nice about Photivo is they have exact the sliders for the lensfun input. So i hope the Huggin procedure will provide a good start and. After that i can find with Photivo the best stettings wich i then check with Bibble and Ufraw. Gimp i will use to provide a clean not tampered tiff with a grid added.
 

indigo

New to Mu-43
Joined
Jul 25, 2011
Messages
2
Your settings seem to overcorrect distortion for me (using both lensfun 2.4 and 2.5 as a plugin in darktable).

Did you use jpegs generated by an external raw converter for the procedure using hugin? Because the Olympus E-P1 (and as I read on the web, the other :43: bodies too) perform an in-camera distortion correction, so the parameters obtained by using the camera generated jpegs are not suitable for the orfs and vice versa.

I did some city test shots with my E-P1 and the 17mm pancake lens and I followed the procedures on the lensfun website (using hugin) with tiff files made from the camera's orf files using ufraw.

I get quite good results (checked distortion on a number of city photos in which I assume buildings have straight edges) with these settings:

HTML:
    <lens>
        <maker>Olympus</maker>
        <model>Olympus Zuiko Digital 17mm F2.8 Pancake</model>
        <mount>Micro 4/3 System</mount>
        <cropfactor>2.0</cropfactor>
        <calibration>
            <distortion model="ptlens" focal="17" a="0.00835" b="-0.04149" c="-0.0022" />
            <tca model="poly3" focal="17" br="-0.0004492" vr="1.0016410" bb="0.0005749" vb="0.9989794" />
        </calibration>
    </lens>

I only checked the TCA correction very quickly, so it could be not that perfect...
 

squeegee

Mu-43 Veteran
Joined
Jan 26, 2010
Messages
403
Your settings seem to overcorrect distortion for me (using both lensfun 2.4 and 2.5 as a plugin in darktable).

Did you use jpegs generated by an external raw converter for the procedure using hugin? Because the Olympus E-P1 (and as I read on the web, the other :43: bodies too) perform an in-camera distortion correction, so the parameters obtained by using the camera generated jpegs are not suitable for the orfs and vice versa.

I did some city test shots with my E-P1 and the 17mm pancake lens and I followed the procedures on the lensfun website (using hugin) with tiff files made from the camera's orf files using ufraw.

I get quite good results (checked distortion on a number of city photos in which I assume buildings have straight edges) with these settings:

HTML:
    <lens>
        <maker>Olympus</maker>
        <model>Olympus Zuiko Digital 17mm F2.8 Pancake</model>
        <mount>Micro 4/3 System</mount>
        <cropfactor>2.0</cropfactor>
        <calibration>
            <distortion model="ptlens" focal="17" a="0.00835" b="-0.04149" c="-0.0022" />
            <tca model="poly3" focal="17" br="-0.0004492" vr="1.0016410" bb="0.0005749" vb="0.9989794" />
        </calibration>
    </lens>

I only checked the TCA correction very quickly, so it could be not that perfect...

The images I used were orf's not jpgs so they were pre-distortion correction. As for darktable, I don't know, I use ufraw and the images come out very nicely in ufraw. Note that your sample is using PTLENS model where as the numbers I posted were for poly3 (can't remember the diff off hand though).

I know my numbers work for UFRaw as I've converted many images since then. It's entirely possible the UFRaw isn't reading the numbers properly - that could explain why the hugin generated numbers didn't do anything useful for me in UFraw.

if I get a chance I'll try to find darktable to install and test out.
 

indigo

New to Mu-43
Joined
Jul 25, 2011
Messages
2
The images I used were orf's not jpgs so they were pre-distortion correction. As for darktable, I don't know, I use ufraw and the images come out very nicely in ufraw. Note that your sample is using PTLENS model where as the numbers I posted were for poly3 (can't remember the diff off hand though).

I know my numbers work for UFRaw as I've converted many images since then. It's entirely possible the UFRaw isn't reading the numbers properly - that could explain why the hugin generated numbers didn't do anything useful for me in UFraw.

if I get a chance I'll try to find darktable to install and test out.

I use the PTLENS model instead of the POLY3 model, because it gives me slightly better results for straight lines which are not parallel with the edges. The PTLENS model is a fourth order model while the POLY3 is a third order model.

For the POLY3 model, I get a "b" or "k1" value of -0.02686, which gave me OK results (not very good, but not that bad either), better than the value of your post. I assume it is the same value you got in your hugin procedure as it is about one fourth of your final value).

For the differences, I see two possibilities: we don't have exactly the same lens (possible if the Olympus guys slightly improved the lens design without telling anybody; my E-P1 is only four months old, being one of the last E-P1s) or we don't have exactly the same software (with all software and library differences, there can be an important difference, or in the library or in the way software calls the library).

I don't think we should spend too much effort on finding the source of the differences. Other users can test both our values and decide which one works better for them or perform the test themselves. Especially when using the hugin procedure, it's not that much work at all.
 

squeegee

Mu-43 Veteran
Joined
Jan 26, 2010
Messages
403
It might be kind of important because the next version of lensfun will ship with. My numbers... So everone will have wrong numbers if they're wrong.

mine is an ep1 + 17mm too, the manufacturers generally don't change things with out at least putting an extra qualifier on the lenses for this reason.
 

squeegee

Mu-43 Veteran
Joined
Jan 26, 2010
Messages
403
okay I just tried both ufraw and darktable,

I can confirm...

In DarkTable
- my numbers are way too strong
- your numbers are near perfect correction

In UFRaw
- my numbers produce results almost identical to in-camera correction
- your numbers have almost no effect

I'm guessing either darktable or UFRaw is stacking the 2.x crop from both the camera setting and the lens setting. I might make a fake 1.0 crop factor setting to test.
 

squeegee

Mu-43 Veteran
Joined
Jan 26, 2010
Messages
403
okay after some more research and testing...

I think UFRaw is not taking the 2x crop factor into account.
So, I think your numbers are techically correct and mine are off by 2x.

I've logged a bug with UFRaw. We'll see what happens.

I'm planning on getting the 45mm lens as soon as it's released so maybe once I get that I'll generate a new set of numbers and submit the correction to lensfun.

thanks for bringing this up, would have never known otherwise.
 

Latest threads

Top Bottom