Lens calibration data (lensfun, version 1) are not recognized by DT 4.0 automatically

Even if you perform the calibration for the APS-C crop, the fallback string AF 85/1.8 II XF currently used by dt on the camera body in question will not be sufficient to identify this lens automatically.

What’s missing?

“Viltrox” in front. (Or any other vendor as this string as it stands might not be unique.)

Lensfun will ignore spaces and case when matching, but won’t do a partial match, I think…

Glenn, frankly I do not know what is missing in order the lense will be identified. The fact is DT does not identify the Viltrox lens automatically. I entered the data exiv2 delivered into .xml file of lensfun database as shown above.

The ~/.exiv2 file already mentioned can tell dt the correct information to pass to lensfun.

True, but only if there is a numerical LensID/LensType to perform the mapping.

The OP still hasn’t shown all the relevant Exif and MakerNote data.

I believe this would function. I am Windows user and DT runs under Windows. I could not find any reliable information what should be the contents of that file and where to locate in Windows system.

I attached a RAW file taken with Fujifilm X-S10 with attached Viltrox 85 mm lens. You can get all the information out of it.
_DSF3267.RAF (25.2 MB)

So the Fujifilm MakerNote doesn’t include the LensID/LensType numerical tag like e.g. Canon or Nikon do, so not sure how the exiv2.ini mapping would work in this case. I’ll have to take a closer look at the exiv2 and dt code when I find some time…

Thank you for your interest in trying to help me. It is not urgent. I think the key point is how DT handles the lensfun database.

I think DT should use the lens corrections embedded in metadata.

Has someone reverse engineered and posted how that metadata works?

Perhaps @agriggio ?

Sorry, what is the question exactly?

Have you reverse engineered and implemented lens correction where the correction data stored in the raw file is used?

Yep, Fujifilm MakerNotes are not bypassed by exiv2.ini (like Minolta, Olympus, Nikon, Canon, etc), so that route is a dead end.

So have to think on the dt side how to improve the detection for Fujifilm cameras. Blindly using LensMaker + LensModel might break currently working things…

What’s interesting is that there is a lensfun crop entry for another Viltrox on the X-mount, which indeed also does not have the “Viltrox” prefix, so they will likely accept another entry like that (the existing one for the full crop and including the prefix being unsuitable and therefore completely different), so this is probably the best bet.

Hi,

Not really. But someone else did, at least in part. There was an announcement here some time ago (1-2 years already maybe?) and an associated pr for darktable, that supported Fuji and Sony cameras. I integrated it into art and extended also to dng files (also not reverse engineered, just taken from the dng spec and adapted from the lcp implementation already available in rawtherapee). IIRC someone else also figured out part of the corrections for Panasonic cameras (or possibly even all m43 cameras), but I haven’t looked into that yet.

Messed around with /src/iop/lens.cc in darktable for 4 hours, just to find out, as someone mentioned, it’s a lensfun problem parsing and matching the lens name. It’s this lensfun function:

FindLenses (const lfCamera *camera, const char *maker, const char *model, int sflags=0)

Specifically it’s having problem with “85/1.8”. If I replace that part by “85 1.8” in both the EXIF of the image, and in the lensfun’s XML file, then darktable/lensfun would have no problem autodetecting the lens.

Here is a JPG with the “Lens Model” in EXIF has been modified to “AF 85 1.8 II XF”.

Here’s the viltrox_85.xml I’m using that would work with the above JPG. The vignetting data is made-up just for testing.

<lensdatabase version="1">
  <lens>
    <maker>Viltrox</maker>
    <model>AF 85 1.8 II XF</model>
    <mount>Fujifilm X</mount>
    <cropfactor>1.53</cropfactor>
    <calibration>
      <distortion model="ptlens" focal="85" a="0" b="0.00846" c="0"/>
      <vignetting model="pa" focal="85.0" aperture="2.5" distance="10" k1="-0.5485433" k2="0.6021258" k3="-0.6310329" />
      <tca model="poly3" focal="85" vr="0.9998219" vb="0.9999488"/>
    </calibration>
  </lens>
</lensdatabase>

Also found out that darktable doesn’t read the lens maker from EXIF (VILTROX), and thus doesn’t pass it to lensfun for searching. I tried passing the lens maker to lensfun’s FindLenses() but that didn’t help. Adding “Viltrox” into the Lens Model didn’t help neither. So, nothing needs to be done to darktable in this case.

One work-around for now is to select the lens manually, apply the default correction or none, then save it as a preset that automatically applied to the matching lens model. That way, the correct lens profile will be automatically pre-selected upon importing the image into darktable.

It’d be nice if OP can submit a bug report to lensfun. Otherwise, I can do that sometime later. I’m using lensfun 0.3.3.

That’s right, adding the correct/expected model for the Fuji body is the only thing to do here. The way the lens string is read and generated on the Nikon body is completely different. Welcome to the world of non-standardized and very fragmented lens recognition.