[CREATE] Lens correction database

Yuval Levy create07 at sfina.com
Thu May 10 20:43:26 PDT 2007


Hi Pablo,

Pablo d'Angelo wrote:
> 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

<http://www.dpreview.com/reviews/dxoopticspro/> not very new, but...


> Who would be interested in using and building such a database?

I'd be willing to build the online tools to enter and manage the database.

I think the best approach is an online submission form where people can
enter each calibration point they performed:
- three images, produced according to calibration specification
- the PTO project file of the calibration they performed according to
calibration specification
- a few fields (mostly free text) to describe their camera/lens kit
- contact information

Then the operators of the database would verify the input and change its
status from experimental to verified. A finer grained verification
process can be added later.

On the other end there would be an export function, where the whole
database or a subset thereof is available in XML format. That XML format
would be used by the tools on the desktop as input parameters in the
correction process.

I expect it to be about two days of intense work to produce the MySQL
database structure; the PHP driven forms for input and XML export. I'll
probably have time toward the end of the month.


> License:

CODE: the code should be free. I'd recommend GPL for the data structure
and the web based application; and something like LGPL for that part of
the code that will be integrated into the applications to do the XML
parsing and actual correction based on the database information. No
restriction on using the code from within closed source applications.

CONTENT/DATABASE: I'd ensure that the database content is owned by one
person/entity with a condition on the entry page stating that "by
entering data in this form, you officially transfer copyright and
ownership of it to <FILL THE BLANK>".

then I'd multi-license the database:
- a free license for non-commercial use within open source applications.
- a small fee for commercial use within open source tools (e.g. 20$).
- a negotiable fee for licensed use in closed source commercial
applications.

I think it is reasonable to ask for money from commercial players,
wether they are users making money using open source code or companies
selling closed source software licenses.

The money can be plugged back in to the community, e.g. code bounties,
hardware, and all the other nice things that money can buy.



> 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.

I see two separate areas below. The lower one with the calibration
information looks good to me, though I'd shorten the tags.

For the identification data, I am not sure about the approach below. It
looks to me as a mix of input to the database and output as used by the
applications. In the end what is required is a set of parameters for
each combination of camera/lens/focal-length/aperture, and a combination
of information to identify the camera/lens/focal-length/aperture used.

Identification by EXIF or other automated mean is unlikely to be
reliable enough in our lifetime. E.g. when an adapter is used in front
of the lens (wide-angle and tele-adapter for point&shoot digitals);
between lens and camera (e.g. the Novoflex adapter to connect Nikon
lenses to Canon bodies); when the image is a scanned negative or slide;
when the manufacturer changed production process / specs w/o changing
the EXIF.

I will assume that the XML below is for the OUTPUT of the system, i.e.
the input that tools like Krita will use when processing (possibly
automatically) input images. My comments between the lines.


> 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>

IIRC, the only relevant factor in terms of camera is the sensor size,
i.e. the cropping factor? The exif data can be used to try to
automatically select the set to use, but should always allow the user to
override the automatic selection.

> 
> 
> 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>

IMO the author is something to keep internally in the database. If
somebody downloads the whole database (which should be available), he
will get the original calibration files and all the relevant process
information (i.e. who calibrated, who verified/rated, etc.) but for all
practical purpose, this information would only clutter things.


>   <!-- 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">

if only the world would be perfect, this would work. However we can not
count on clean data to this level of precision. Hence, for the quite
common situation of a manufacturer changing the characteristics of a
lens without changing it's name (e.g. Nikon 8mm et al.) the only viable
solution is to rely on user judgement.


> 
>   <!-- arbitrary user comment -->
>   <comment></comment>
> 

I would solve the whole above in something like this (annotated version
of that same XML below):


<lens>
  <entry>1234</entry>
  <description>Nikkor 8mm</description>
  <detail>this is applicable to the last batch of these Nikkor lenses
          from serial number 12345678 up</detail>
  <camera>Canon EOS 350D</camera>
  <camera>Canon Digital Rebel XT</camera>
  <camera>Canon Kiss n Digital</camera>
  <crop factor>1.6</crop factor>
  <min_fl>8</min_fl>
  <max_fl>8</max_fl>
  <max_f>2.8</max_f>
  <type>ortographic</type>
  <status>1</status>
  <calibration>
    <focal length="8">
      ... same things as radial distortion and tCA from below
      <aperture f="2.8">
        .. same things as below under calibration
      </aperture>
    </focal>
  </calibration>
</lens>


ANNOTATED VERSION

<lens>

  <entry>1234</entry>

/* unique entry ID to identify the specific lens. Can be used to be
stored in preferences so that user need not disambiguate each time */

  <description>Nikkor 8mm</description>

/* this description might be ambiguous, e.g. when there are multiple
entries. They will appear ambigous also in a drop-down menu and will
force the user to identify which of the many variations of the same
lense he has. */

  <detail>this is applicable to the last batch of these Nikkor lenses
          from serial number 12345678 up</detail>

/* the detail will be instrumental to disambiguate. Ideally it will
appear as a pop up when hovering over the lens names in the drop down */

  <camera>Canon EOS 350D</camera>
  <camera>Canon Digital Rebel XT</camera>
  <camera>Canon Kiss n Digital</camera>

/* one lens can be associated with many cameras, e.g. like above when
the same camera is marketed under different names; or when cameras have
same crop and thus same correction parameters. Ideally the user
selection process when using the database will be camera first and then
a list of lenses (descriptions) associated with it. */

  <crop factor>1.6</crop factor>

/* most relevant information about the camera. can be helpful if the
user has a camera not yet listed in the database. */

  <min_fl>8</min_fl>
  <max_fl>8</max_fl>
  <max_f>2.8</max_f>

/* general information about the lens. */

  <type>ortographic fisheye</type>

/* type of lens */

  <status>1</status>

/* status of entry. maybe a number is not the best thing. entries could
have certified or non-certified status. might be of interest for
disambiguation as well. should provide a category for personal values,
i.e. when a user calibrates his own lens and prefers to rely on his own
work rather than on the collective wisdom of database contributors. */

  <calibration>
    <focal length="8">
      ... same things as radial distortion and tCA from below
      <aperture f="2.8">
        .. same things as below under calibration
      </aperture>
    </focal>
  </calibration>

/* the calibration information is the same as listed by Pablo below. */

</lens>


cheers
Yuv




>   <!-- 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
> CREATE at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/create



More information about the CREATE mailing list