lensfun  0.3.1.0
Lens database

Lensfun uses an XML-based format for its database. A single XML file can contain entries for mounts, cameras and lenses. The whole file content is enclosed in a <lensdatabase> element.

The database is made of multiple XML files, conventionally split by manufacturer and camera type. Compact, SLR, and mirrorless cameras/lenses are split apart for easier maintainance.

The database contains three kinds of objects: mounts, cameras and lenses.

Every camera has a mount type assigned (and only one). Similarily, lenses also have a list of mounts assigned, because lenses often come in several variants with different mounts. Finally, every mount has assigned a list of compatible mounts, so if your camera has mount B which is compatible with mount A, you can list all the lenses that come either with mounts A or B. However, there are various custom adapters that can be used to connect lenses to bodies with “incompatible” mounts, so the application in any case may provide a mean to choose from the whole list in addition to filtering lenses by mount.

The cameras may be autodetected by using EXIF information from the source image. However, the lensfun library is not tied in any way to EXIF tags, it is in the application's responsibility to read those tags in any way they like. In fact, you may detect the camera which was used to take the image in some other way (for example, if you want to use lensfun for processing images taken from videocams, which usually do not use EXIF, or scanned images from film cameras), you may even ask the user directly to choose the camera from a list.

Same about lenses: you may either autodetect them (which is tricky even if you have EXIF information, since unlike camera/model the lens model is highly manufacturer-dependent and is usually hidden in the Exif.MakerNote tag which is a big binary blob; luckily the exiv2 library can parse many vendor-specific MakerNote's), or you may provide some mean for the user to enter the lens model manually. The lensfun library will help you a little here, since it provides a means to match a set of lenses from the database given a human-entered lens description (e.g. fuzzy lens search).