Declaring lenses: <lens>

Possible embedded elements:

Lens maker.
Lens model. This must be specified exactly as it is returned by EXIF reading libraries to allow for automatic recognition of the lens. However, upper and lower case doesn't matter, neither does the ordering of the “words” in the lens model name. A “word” in Lensfun interpretation is a sequence of characters of the same type (Lensfun senses three character types: digits, punctuation characters and all others). Words made of single punctuation characters are ignored. Also, as a special exception, the word consisting of a single “f” is ignored too. So, “[IF]” is really split into three words – “[”, “IF”, “]”, and then first and last words are discarded. Accordingly, “smc PENTAX-DA 12-24mm F4 ED AL [IF]” is split into “smc”, “pentax”, “da”, “12”, “24”, “mm”, “4”, “ED”, “AL”, “IF”. Have a look at other lenses of the same manufacturer for the naming conventions. See below for further information about the parsing of the model name field.
Lens type. This is one of: “rectilinear", “fisheye”, “panoramic”, “equirectangular”, “orthographic”, “stereographic”, “equisolid”, “fisheye_thoby”. If this field is not given, Lensfun assumes rectilinear.
<focal min="number" max="number" value="number" />
Lens focal length in mm. This can be either a single value for a fixed-focal length lens, or a minimum and maximum value in the case of a zoom lens.
<aperture min="number" max="number" value="number" />
Lens aperture as the f-number. This can be either a single value for a fixed-aperture lens (very rare), or the minimal and maximal possible f-stop number for this lens (over the whole zoom range for a zoom lens).
Lens mount. There can be multiple <mount> entries if the same lens is manufactured with several mounts, or it has a variable mount (e.g. Tamron Adaptall).
This is the crop factor of the camera with which all shots for computing distortion models were made. The library will compute correction factors if you used this lens on another camera with a different crop factor. Generally it is advised to use a camera with maximal crop factor for this lens, because the models may become imprecise for crop factors smaller than the one used for models.
This is the aspect ratio of the camera with which all shots for computing distortion models were made. It is the ratio of the longer edge to the shorter edge. Lensfun needs the aspect ratio internally for correct application of the distortion parameters. You may give it is as a real number or as a ratio with a colon like “4:3”. It defaults to 1.5 or 3:2.
<center x="number" y="number" />
The decentering of the lens, i.e. the offset of its optical axis from the center of the viewframe. “x” denotes the offset in horizontal direction, “y” in vertical direction. The scale is so that the smaller dimension (for very most cameras the height) has the value 2. Both offsets default to 0. It may be particularly helpful for shift lenses.
<calibration>calibration data</calibration>
Lens calibration data format

Library recognizes several ways to specify lens parameters directly in lens model name. The first way to specify lens focal length and aperture range is “[min focal]-[max focal]mm f/[min aperture]-[max aperture]” where the “mm” and “f/” are totally optional. For primes the 'max' values may be omited. Examples:

Another pattern for lens parameters is “[min aperture]-[max aperture]/[min focal]-[max focal]”. Examples:

(Note that “max aperture” refers here to the minimal f-stop number at the maximal focal length of a zoom lens. Its value is ignored by Lensfun. As explained above, Lensfun only stores the minimal and maximal possible f-stop number of the lens, not matter at which focal length, e.g. 3.5–32.)

If the focal length in the lens model name is wrong because a converter is used, one of the words “converter” or “extender” must appear somewhere in the lens model name.

Moreover, the library finds missing min/max values for focal length and aperture by looking at the range of these parameters in the <calibration> section.