Hi together Some people who have attended my talk about hugin at the LGM might remember that I proposed to build a database of lens correction coefficients, that can be used by open source software (such as ufraw, gimp, krita, digikam, f-spot, etc) to automatically correct for lens "defects" such as lens distortion, vignetting and even transverse chromatic abberation.
The slides for my LGM talk are available at: http://hugin.sf.net/tech/LGM_2007.pdf At least the Krita people are interested in such functionality: http://www.valdyas.org/fading/index.cgi/2007/05/08#hugin I plan to write a lightweight C library that contain the main pieces of code required to apply the corrections and use the proposed database. Current situation: Several databases and associated programs for correcting lens defects exist. For example PTLens uses a database with lens distortions coefficients. Unfortunately, Its author, Thomas Niemann has decided to close and encrypt the underlaying database a bit more than one year ago, shortly after I wrote "fulla", a command line tool to correct lens distortion. fulla can use the old, unencrypted PTLens database and correct distortions in images automatically. Note that PTLens requires manual user interaction for other corrections (vignetting, chromatic abberation). http://epaperpress.com/ptlens/ In a sense the proposed database is a free alternative to the PTLens database, but additionally can include coefficients for automatic correction of vignetting and chromatic abberations. DxO is a commercial software that can correct the mentioned defects and even more. Obviously their database and correction methods are not available. http://www.dxo.com Proposed solution: ================== Before that can happen, we need to agree on a database format that can include all required parameters. This specifically includes: During the panorama stitching process, hugin is required to correct these distortions, and can thus be used for estimation of the calibration parameters. The idea is that people who want to correct their lens take some test shots, and use hugin to estimate the required calibration parameters. These are then sent (hugin projects and original images) to a lens database coordinator, where they are checked for plausibility and incorporated into the database. Scope of database: 1. Distortion correction: radial distortion, same as PTLens, 3 parameter radial polynmial, described in detail at: http://wiki.panotools.org/Lens_correction_model Varies mainly with focal length. Parameters can be estimated at several focal lengths and interpolated in between. Each focal length requires a single image for calibration. 2. Vignetting correction: radial correction, radial vignetting correction by division: I = I / (1 + b*r^2 + c*r^4 + d*r^6) The parameters vary with both focal length and aperture. Each focal length and aperture setting require 2 or 3 images for calibration. 3. Chromatic abberations: Individual distortion correction of red and blue channel, parameters can be estimated using hugin (more work than the other approaches), or by trial and error. Most lenses require just a single scaling factor. Mainly depends on focal length. Instructions for estimating the respective parameters with hugin are in the works. Who would be interested in using and building such a database? License: What kind of license should be used (for the code and more important, the database)? A GPL like license to restrict usage to open source software or a LGPL like license? Or a non-commercial license? Can code licences be applied to databases? Database (XML) layout: For each camera and lens, a single entry would be required. Note that my XML skills are seriously lacking, so any comments with respect to a different xml syntax are appreciated. Camera description: =================== <!-- name of the camera, crop factor --> <camera make="Canon" name="EOS 300D" cropfactor="1.6"> <!-- exif data required for recognition of the camera --> <exif make="Canon" model="Canon EOS 300D DIGITAL"/> <!-- mount of the camera (used to identify matching lenses) --> <mount>canonSLR</mount> <mount>canonEfsSLR</mount> <mount>genericSLR</mount> <!-- a free from text field for misc annotations --> <comment>Any annotation</comment> </camera> Description of a lens: ====================== <lens name="Canon EF-S 10-22mm f/3.5-4.5 USM" minfocallength="10" maxfocallength="22" maxaperture="3.5" <!-- type of lens, either rectilinear or fisheye --> type="rectilinear"> <!-- person calibrating the lens --> <author>Author</author> <!-- mount(s) of a lens (ie. the type of cameras it can be mounted on) --> <mount>canonEfsSLR</mount> <!-- a rating (quality control passed or not) --> <rating>1</rating> <!-- serial number range (for lenses with same name but different properties, not required) --> <serial number="300" min="1" max="1000"> <!-- arbitrary user comment --> <comment></comment> <!-- correction coefficients for each focal length <calibration focallength="10"> <!-- radial distortion correction, as in PTLens --> <distortion a="0.02" b="-0.012" c="0"> <!-- transverse chromatic abberation correction --> <tcaRed a="0" b="0" c="0" d="0"> <tcaBlue a="0" b="0" c="0" d="0"> <!-- aperture specific calibration values (vignetting) --> <calibration aperture="3.5"> <vignetting b="-0.1" c="-0.2 d="0"> </calibration> <calibration aperture="8"> <vignetting b="-0.1" c="-0.2 d="-0.3"> </calibration> <calibration aperture="22"> <vignetting b="-0.1" c="-0.2 d="0"> </calibration> </calibration> <calibration focallength="14"> <distortion a="0.003" b="-0.001" c="0"> <tcaRed a="0" b="0" c="0" d="0"> <tcaBlue a="0" b="0" c="0" d="0"> <calibration aperture="4"> <vignetting b="-0.1" c="-0.2 d="0"> </calibration> <calibration aperture="8"> <vignetting b="-0.1" c="-0.2 d="-0.3"> </calibration> <calibration aperture="22"> <vignetting b="-0.1" c="-0.2 d="0"> </calibration> </calibration> <calibration focallength="22"> <!-- some more data --> </calibration> </lens> Any feedback appreciated. Please continue discussion on the CREATE mailing list. ciao Pablo _______________________________________________ CREATE mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/create
