Exiv2 / exiv2

Image metadata library and tools

Home Page:http://www.exiv2.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lens Recognition for Sigma 50-100mm f/1.8 Art

migle opened this issue · comments

Is your feature request related to a problem?

No automatic lens detection by lensfun / darktable 4.2 possible (lens type unknown)
Lens Sigma 50-100mm f/1.8 DC HSM Art

$ exiv2 -pt IMG_7145.CR3 | grep -i lens
Exif.Photo.LensSpecification Rational 4 50/1 100/1 0/1 0/1
Exif.Photo.LensModel Ascii 31 50-100mm F1.8 DC HSM | Art 016
Exif.Photo.LensSerialNumber Ascii 11 0000000000
Exif.CanonCs.LensType Short 1 624
Exif.CanonCs.Lens Short 3 50.0 - 100.0 mm
Exif.CanonFi.RFLensType SShort 1 n/a
Exif.Canon.LensModel Ascii 138 50-100mm F1.8 DC HSM | Art 016

Desktop

Additional context

Raw sample picture https://ramos.link/nextcloud/index.php/s/iCZmJzPejSGbGBm
Lens info https://www.sigma-global.com/en/lenses/a016_50_100_18/

It seems that this lens in the source code for exiv, however, mine, with my camera, Canon EOS 90D, is not detected.

Exif.CanonCs.LensType Short 1 624

As a workaround, you can use this ID value in your local ~/.exiv2 config file to assign it the desired lens model name string.

One point here is, that the ID should be considered in canonmn_int.cpp. I can have a look on this.

The second point: Assuming that lensfun / darktable 4.2 use easyaccess to get lens name, we might think about the sequence, in which the different lens name tags are configured in easyaccess. Exif.CanonCs.LensType is chosen before Exif.Canon.LensModel. But as Exif.Canon.LensModel is Ascii, it needs no translation, which currently is missing with Exif.CanonCs.LensType. So when Exif.Canon.LensModel gets higher priority, in this case (and perhaps in several other cases) lens name would return a valid name.

Assuming that lensfun / darktable 4.2 use easyaccess to get lens name

It does not - darktable has a home-cooked search sequence depending on camera make - for Canon it will specifically look for Exif.CanonCs.LensType (if not an RF mount).

That string is then passed to lensfun, which has to be in the lensfun database as such (verbatim match, with whitespace eliminated IIRC).

Note that this lens seems to be in the lensfun database as Sigma 50-100mm f/1.8 DC HSM Art.

Also note that this lens (or a very similar one?!) seems to have an ID of 168 according to exiftool, and is also listed under ID 168 in exiv2's canonmn_int.cpp.

So I'm not really sure what's going on here.

Ok, so for lensfun / darktable, a change in easyaccess will not improve anything. However, I think changing sequence in easyaccess could be a benefit for those getting lens name via easyaccess. So I intend to have a look on other samples to see what could be the impact.

Locally I have prepared the change to add the lens with ID 624. I am also surprised to see that entry from exiftool (thank you @kmilos). The output from @migle shows "Art 016" at the end of lens name. Perhaps this indicates to be a newer version of that lens.

Not sure, what to do now. Based on the provided data from @migle, I tend to create a pull request with my changes already prepared. But if there are doubts left, I wait until clarification.

Ok, so for lensfun / darktable, a change in easyaccess will not improve anything. However, I think changing sequence in easyaccess could be a benefit for those getting lens name via easyaccess. So I intend to have a look on other samples to see what could be the impact.

Again, please be aware that the "easyaccess" API was meant to be there only for convenience (mainly for internal use by the exiv2 CLI tool) and any level of service was never, and cannot ever be guaranteed because of corner cases like these.

Not sure, what to do now.

Nothing. The OP can work around w/ the inifile, no?

P.S. I personally intend to spend no time on supporting the legacy Canon lens detection.

Looking into the list of lenses known by exiftool (thanks to @kmilos for the link), If found several lenses entered there with two Ids, some even with three (e.g. Sigma 150-600mm f/5-6.3 DG OS HSM | S as 172, 183 and 368). So obviously it happens from time to time, that a lens gets a second Id.

Therefore I created pull request #2786.