PDA

View Full Version : Lens Correction



Dazz1
12-10-2014, 10:49am
It having trouble with lens correction for my Sigma DC 18-250mm 1:3.5-6.3 MACRO HSM lens.

I noticed that UFRaw selects a Tamron AF 18-250mm F3.5-6.3 Di II LD Aspherical [IF] MACRO automatically, even though the EXIF data identifies the Sigma lens correctly. I suspect that is because UFRaw doesn't have a correction profile for that exact lens and is choosing, what it thinks is, a near equivalent. However, UFRaw does have a profile for the Sigma 18-200mm lens. Is the Tamron lens with the same zoom range a better substitute than a Sigma 18-200mm I wonder?

Alternatively I also use Rawtherapee (actually prefer it) which can use lens correction profiles (lcp files) that Adobe uses. However, I haven't been able to find one for this Sigma lens yet. I don't suppose someone here has an lcp file for this lens? If not, what should/can I substitute?

tduell
12-10-2014, 1:28pm
You may be able to get a feel for the accuracy of a particular lens correction by shooting some straight lines, e.g a building, and see how well the correction straightens the lines.
I see you use hugin, you be able to use it to do your lens correction and then check the parameters, but I don't know if hugin's lens correction model is the same as that used by Rawtherapee. There is a version of hugin which uses Lensfun which probably has your lens (I haven't checked), which maybe another way of correcting your images. All this is a bit long winded relative to doing the correction in your post processing software, but it may help a bit.

Cheers,
Terry

ricktas
12-10-2014, 1:53pm
PTLens is a great plugin for lens correction. Not sure if they have your Sigma on the list, but worth a look.

tduell
12-10-2014, 3:45pm
Just did a snoop on the Lensfun site. UFRaw should select the correct lens as your lens is in the Lensfun database <http://lensfun.sourceforge.net/lenslist/>.
You should be able to manually look at the content of the Lensfun database you have installed on your system to see if your version has your lens data.
On linux you will find the Lensfun database in /usr/share/lensfun. Not sure where Windows or OS X would put it. Look at the slr-sigma.xml file with a text editor.
If your local Lensfun doesn't have your lens then the answer is to update to the latest version, assuming the content of that is what is being reported on the Lensfun site.


Cheers,
Terry

Dazz1
12-10-2014, 7:33pm
PTLens is a great plugin for lens correction. Not sure if they have your Sigma on the list, but worth a look.

Thanks. I had a look at the site. Looks good, but doesn't seem to have a version that is usable under linux (Gimp, UFRaw, or RawTherapee) unfortunately.

- - - Updated - - -


Just did a snoop on the Lensfun site. UFRaw should select the correct lens as your lens is in the Lensfun database <http://lensfun.sourceforge.net/lenslist/>.
You should be able to manually look at the content of the Lensfun database you have installed on your system to see if your version has your lens data.
On linux you will find the Lensfun database in /usr/share/lensfun. Not sure where Windows or OS X would put it. Look at the slr-sigma.xml file with a text editor.
If your local Lensfun doesn't have your lens then the answer is to update to the latest version, assuming the content of that is what is being reported on the Lensfun site.

Cheers,
Terry


You are right, it is there in the new versions. The latest version doesn't seem to have been packaged yet for my distro of linux (Mint, Ubuntu, Debian). Guess I will have to compile it myself to get UFRaw up to speed (unless I can just replace the database).

Alternatively, have just found that Adobe has software to create your own lens profiles from an image of a calibration card. If I do that, I will be able to use rawtherapee, which as I hinted above, I kinda prefer anyway. Added bonus, it will be a profile for my particular lens (not just an average of what comes off the production line) and camera combo.

At least I have some options now to pursue. Thanks.

Dazz1
12-10-2014, 9:01pm
Well, first success.I downloaded the source for the new lensfun, and after a couple of problems, got it to compile.

The trouble is make install put things in different places to the version currently on my system, for example, /usr/local/share/lensfun instead of /usr/share/lensfun. I find it annoying that they can't agree on where things are supposed to go.

Anyway, I tried just copying over the xml file for the sigma lenses, but that doesn't work, so I hacked the old xml file to add just the data for my lens. Basically added


<lens> <maker>Sigma</maker>
<model>Sigma 18-250mm f/3.5-6.3 DC OS Macro HSM</model>
<mount>Canon EF</mount>
<mount>Sigma SA</mount>
<mount>Nikon F AF</mount>
<mount>Sony Alpha</mount>
<mount>Pentax KAF2</mount>
<cropfactor>1.523</cropfactor>
<calibration>
<!-- Taken with Sony Alpha 55V -->
<distortion model="ptlens" focal="18" a="0.03419" b="-0.09116" c="0.04125" />
<distortion model="ptlens" focal="22" a="0.02775" b="-0.06342" c="0.04051" />
<distortion model="ptlens" focal="26" a="0.02884" b="-0.05966" c="0.03629" />
<distortion model="ptlens" focal="35" a="0.00054" b="0.03391" c="-0.04229" />
<distortion model="ptlens" focal="135" a="0.00826" b="-0.02182" c="0.04344" />
<distortion model="ptlens" focal="180" a="0.01526" b="-0.04617" c="0.06437" />
<distortion model="ptlens" focal="250" a="0.01692" b="-0.05498" c="0.07496" />
<tca model="poly3" focal="18" br="0.0000694" vr="1.0004727" bb="-0.0000955" vb="1.0002783" />
<tca model="poly3" focal="22" br="0.0000250" vr="1.0004101" bb="-0.0000327" vb="1.0002243" />
<tca model="poly3" focal="26" br="-0.0000025" vr="1.0003871" bb="-0.0000482" vb="1.0002292" />
<tca model="poly3" focal="30" br="-0.0000027" vr="1.0002919" bb="-0.0000523" vb="1.0002181" />
<tca model="poly3" focal="35" br="-0.0000256" vr="1.0002410" bb="-0.0000116" vb="1.0000706" />
<tca model="poly3" focal="50" br="-0.0000453" vr="1.0001936" bb="-0.0000183" vb="1.0000476" />
<tca model="poly3" focal="75" br="-0.0000103" vr="1.0000727" bb="-0.0000364" vb="1.0000054" />
<tca model="poly3" focal="135" br="-0.0000020" vr="0.9999291" bb="-0.0000215" vb="0.9999288" />
<tca model="poly3" focal="180" br="-0.0000950" vr="0.9999136" bb="-0.0000108" vb="0.9995579" />
<tca model="poly3" focal="250" br="-0.0000950" vr="0.9999277" bb="0.0000332" vb="0.9994025" />
</calibration>
</lens>





and now, hey presto, UFRaw automatically selects and uses the right lens correction.


Tomorrow's job will be to create my own lcp file for rawtherapee, then both will be working.

Dazz1
14-10-2014, 8:08pm
Just a follow up on the lcp file, rawtherapee side of things. I have tried a couple of lcp files, supposed to be for my lens. They produce very different results, and neither seem to result in as accurate a result (straight lines that should straight) as the lensfun system does under UFRaw.

It seems that, using the Adobe free software for lens profile creation, you are encouraged to upload the result and share it with others. I don't know whether these uploaded files make their way into Adobe's commercial software, like photoshop, of if hey do, how they are vetted for quality. It would seem to me that, of the two examples I have, one has to be wrong, or maybe both. Maybe the quality of many lcp files floating around out there are dodgy.

When I get the time, I need to print out the chart and take the many photos required to generate my own. It's quite a lengthy process unfortunately :( Meanwhile, I can use UFRaw/lensfun on the photos that require correction.