Lensfun - Not finding the right lens

Did see the link in your link (at exiv2) a few days ago about the extender case and with Tamron. Exiftool link was new to me. Third-party with the same LensID nr. A reason why I only use Canon lenses. Or it was a reason.

Have checked this a little bit more. The order darktable reads lens tags seem to be the culprit. Reading Exif.CanonCs.LensType before reading Exif.Photo.LensModel. It seems Canon Digital Photo 4 reads Exif.Photo.LensModel or Exif.Photo.LensModel first. Open a raw file in DPP4 and press CTRL+I. DPP4 will report EF35mm f/1.4L USM instead of Canon EF 35mm f/1.4L.

Some Canon lenses and cameras:

And the source code from darktable how to read the lens tags:

/* Read lens name /
if((FIND_EXIF_TAG(“Exif.CanonCs.LensType”)
&& pos->print(&exifData) != “(0)”
&& pos->print(&exifData) != “(65535)”)
|| FIND_EXIF_TAG(“Exif.Canon.0x0095”))
{
dt_strlcpy_to_utf8(img->exif_lens, sizeof(img->exif_lens), pos, exifData);
}
else if(Exiv2::testVersion(0,25,0) && FIND_EXIF_TAG(“Exif.PentaxDng.LensType”))
{
dt_strlcpy_to_utf8(img->exif_lens, sizeof(img->exif_lens), pos, exifData);
}
else if(FIND_EXIF_TAG(“Exif.Panasonic.LensType”))
{
dt_strlcpy_to_utf8(img->exif_lens, sizeof(img->exif_lens), pos, exifData);
}
else if(FIND_EXIF_TAG(“Exif.OlympusEq.LensType”))
{
/
For every Olympus camera Exif.OlympusEq.LensType is present. */
dt_strlcpy_to_utf8(img->exif_lens, sizeof(img->exif_lens), pos, exifData);

  /* We have to check if Exif.OlympusEq.LensType has been translated by
   * exiv2. If it hasn't, fall back to Exif.OlympusEq.LensModel. */
  std::string lens(img->exif_lens);
  if(std::string::npos == lens.find_first_not_of(" 1234567890"))
  {
    /* Exif.OlympusEq.LensType contains only digits and spaces.
     * This means that exiv2 couldn't convert it to human readable
     * form. */
    if(FIND_EXIF_TAG("Exif.OlympusEq.LensModel"))
    {
      dt_strlcpy_to_utf8(img->exif_lens, sizeof(img->exif_lens), pos, exifData);
    }
    /* Just in case Exif.OlympusEq.LensModel hasn't been found */
    else if(FIND_EXIF_TAG("**Exif.Photo.LensModel**"))
    {
      dt_strlcpy_to_utf8(img->exif_lens, sizeof(img->exif_lens), pos, exifData);
    }
    fprintf(stderr, "[exif] Warning: lens \"%s\" unknown as \"%s\"\n", img->exif_lens, lens.c_str());
  }
}
else if((pos = Exiv2::lensName(exifData)) != exifData.end() && pos->size())
{
  dt_strlcpy_to_utf8(img->exif_lens, sizeof(img->exif_lens), pos, exifData);
}

// finally the lens has only numbers and parentheses, let's try to use
// Exif.Photo.LensModel if defined.

If I erase Exif.CanonCs.LensType, $ exiv2 -M"del Exif.CanonCs.LensType" 300x2III.CR2 darktable identify the lens correctly by searching for the next, and right, tag.

RawTherapee has no issue to read the right Exif tag even if I didn’t erase any tag.

I did add FIND_EXIF_TAG(“Exif.Canon.LensModel”) before FIND_EXIF_TAG(“Exif.CanonCs.LensType”) in exif.cc and compiled darktable.

All extenders are found now by lens correction module.
What happend instead was that I lost the lens reading from https://raw.pixls.us/getfile.php/1791/nice/Canon%20-%20EOS%2030D%20-%20RAW%20(3:2).CR2 but not from https://raw.pixls.us/getfile.php/1307/nice/Canon%20-%20EOS%20D30%20-%20RAW%20(3:2).CRW

Probably because there is a tag, but it is emty.

Issue created at Github here https://github.com/darktable-org/darktable/issues/10070

Problem solved. In the configuration file ~.exiv2 I wrote 142=000
It will probably fail for older Canon cameras that only have the tag LensType, but they will not find the converters anyway.

Same with EF 800mm f/5.6L IS USM from 2008 as with EF 300mm f/2.8L IS USM from 1999. Canon EF 70-200mm f/2.8L IS II USM was made 2010, so lenses after that should work.

Bypass the exiftag LensType in the configuration file .exiv2 so that it will use LensModel instead.

249=000