Lensfun - Not finding the right lens

As I thought, Lens ID is 142 for them all.

What I found is that in darktable it was searching for the name Canon EF 300mm f/2.8L IS
I changed slr-canon.xml from EF300 f/2.8L IS USM to Canon EF 300mm f/2.8L IS and that one works now. So it reads LensType and not LensModel.

x1.4 II and x2 III worked before but now none of the three converters are identified.

C00 files below

300.CR2 (29.4 MB)
300x1_4II.CR2 (29.0 MB)
300x1_4III.CR2 (29.7 MB)
300x2III.CR2 (27.8 MB)

slr-canon.zip (59.6 KB)

If your lens names are not matching, the correct fix is to use a ~/.exiv2 file to map the correct name to your lens.

Changing the name in lensfun means it’ll get over written the next time lensfun updates.

In this case it will be me who sends the data to Lensfun. If it doesnt work for me it will not work for others. If this would be about another lens already in Lensfun, then .exiv2 would be the best solution for just me.

With that said my biggest issue is still that I can get one of the four combinations to work, but not four.

One step closer. I forgot to type extender in the model place in the xml file. Still not working.

If you use the .exiv2 file you can just make the name match whatever lensfun has.

Even extenders? LensID is the same for all four combinations.

You can match on whatever you’d like.

So should I put it like this?

142 = 300 f2.8L IS USM
142 = 300 f2.8L IS USM +1.4II extender
142 = 300 f2.8L IS USM +1.4III extender
142 = 300 f2.8L IS USM +2III extender

You can’t match on the same thing, so find the teleconverter tag and match on that

Any idea about how to match? Haven’t found any more details about /.exiv2 than 142=single lens without extender

The raw files to try on are published above.

142 +1.4x III=EF300mm f/2.8L IS USM +1.4x III extender didn’t work.

I go back to this thread when I’m having issues: Can't locate ~/.exiv2 file - Exiv2

1 Like

Nothing new there. Try yourself with my raw files. The issue here is extenders. Not a single lens. A single lens is easy and that is what you have been linking to all the time.

It seems .exiv2 is not created for a lens with different extenders so the walk around most be something else. Why, for example, is not darktable reading the tags LensModel? A bug?

Tried with my 200/2.8L IS USM II. It works differently. LensType changes with the extender. Well, not for +1.4II and +1.4III. It means that it in this case would be possible to use .exiv2 to point it right, but only to choose one +1.4

C00 files below
200_2III.CR2 (22.3 MB)
200_14III.CR2 (23.9 MB)
200_14II.CR2 (23.5 MB)
200.CR2 (24.5 MB)

I understand your frustration, but its really the fault of the manufacturers. Someone beat you by ~3 years: Wrongly identified Canon 2x extender as 1.4x extender with Tamron 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