Bug #1328

Sigma 18-300mm is wrongly reported as a Canon 75-300mm

Added by Jean-Luc Jean-Luc Coulon 12 days ago. Updated 11 days ago.

Status:ClosedStart date:06 Dec 2017
Priority:NormalDue date:
Assignee:Robin Mills% Done:

100%

Category:lensEstimated time:1.00 hour
Target version:0.27

Description

Hi,
If I use exiv2 on a .cr2 file from a Canon EOS 80 with a Sigma 18-300mm f/3.5-6.3 DC Macro OS HS attached, it is reported as Canon EF 75-300mm f/4-5.6 IS USM.

Here are the output of exiv2 on this image:
exiv2 -pt IMG_4575.CR2 | grep Lens
Exif.CanonCs.LensType Short 1 Canon EF 75-300mm f/4-5.6 IS USM
Exif.CanonCs.Lens Short 3 18.0 - 300.0 mm
Exif.Canon.LensModel Ascii 74 18-300mm
Exif.Photo.LensSpecification Rational 4 18/1 300/1 0/1 0/1
Exif.Photo.LensModel Ascii 9 18-300mm
Exif.Photo.LensSerialNumber Ascii 11 0000000000

If I use exiftool on the same file, it reports a slighly different LensType but the right one as Lens ID:
exiftool IMG_4575.CR2 | grep Lens
Lens Type : Canon EF 75-300mm f/4-5.6 IS USM or Sigma Lens
Lens Drive No AF : Focus search on
Retract Lens On Power Off : Enable
Lens Info : 18-300mm f/0
Lens Model : 18-300mm
Lens Serial Number : 0000000000
Lens : 18.0 - 300.0 mm
Lens ID : Sigma 18-300mm f/3.5-6.3 DC Macro OS HS
Lens : 18.0 - 300.0 mm (35 mm equivalent: 28.0 - 466.3 mm)

The exiv2 version is:
exiv2 0.26 001a00 (64 bit build)

I run debian/sid

Jean-Luc

IMG_4575.exv (2.35 KB) Jean-Luc Jean-Luc Coulon, 06 Dec 2017 10:10

History

#1 Updated by Jean-Luc Jean-Luc Coulon 12 days ago

Attached the .exv file

#2 Updated by Robin Mills 12 days ago

Can you send me a test image using your lens. Please read this issue report: http://dev.exiv2.org/issues/1327 I recommend that you add your lens to ~/.exiv2. Lens recognition involves an element of guessing because the manufacturers frequently use the same LensID for several different lenses.

Thank you for file IMG_4575.exv. This file only contains XMP data. Can you attach the original image please?

#3 Updated by Robin Mills 11 days ago

  • Category set to lens
  • Status changed from New to Closed
  • Assignee set to Robin Mills
  • Target version set to 0.27
  • % Done changed from 0 to 100
  • Estimated time set to 1.00

#4 Updated by Jean-Luc Jean-Luc Coulon 11 days ago

You can find the original image on the following link (it is too big – 37 MB – to be accepted by the bug report system). As it is not my lens I cannot supply a smaller one in a reasonable delay.

http://famille-coulon.fr/fichiers-temporaires/IMG_4575.CR2

Regards

Jean-Luc

#5 Updated by Robin Mills 11 days ago

Thanks for the test file. Here's the "default" behaviour:

521 rmills@rmillsmbp:~/Downloads $ exiv2 -pa --grep lens/i IMG_4575.CR2 
Exif.CanonCs.LensType                        Short       1  Canon EF 75-300mm f/4-5.6 IS USM  <--- Exiv2 "thinks" it a Canon lens
Exif.CanonCs.Lens                            Short       3  18.0 - 300.0 mm
Exif.Canon.LensModel                         Ascii      74  18-300mm
Exif.Photo.LensSpecification                 Rational    4  18/1 300/1 0/1 0/1
Exif.Photo.LensModel                         Ascii       9  18-300mm
Exif.Photo.LensSerialNumber                  Ascii      11  0000000000
522 rmills@rmillsmbp:~/Downloads $ exiv2 -pv --grep lens/i IMG_4575.CR2 
0x0016 CanonCs      LensType                    Short       1  197  <---- this is the LensID
0x0017 CanonCs      Lens                        Short       3  300 18 1
0x0095 Canon        LensModel                   Ascii      74  18-300mm
0xa432 Photo        LensSpecification           Rational    4  18/1 300/1 0/1 0/1
0xa434 Photo        LensModel                   Ascii       9  18-300mm
0xa435 Photo        LensSerialNumber            Ascii      11  0000000000
I've edited ~/.exiv2
523 rmills@rmillsmbp:~/Downloads $ bbedit ~/.exiv2 
524 rmills@rmillsmbp:~/Downloads $ cat ~/.exiv2
[canon]
197=Sigma 18-300mm f/3.5-6.3 DC Macro OS HS

And your lens is now identified:
525 rmills@rmillsmbp:~/Downloads $ exiv2 -pa --grep lens/i IMG_4575.CR2 
Exif.CanonCs.LensType                        Short       1  Sigma 18-300mm f/3.5-6.3 DC Macro OS HS
Exif.CanonCs.Lens                            Short       3  18.0 - 300.0 mm
Exif.Canon.LensModel                         Ascii      74  18-300mm
Exif.Photo.LensSpecification                 Rational    4  18/1 300/1 0/1 0/1
Exif.Photo.LensModel                         Ascii       9  18-300mm
Exif.Photo.LensSerialNumber                  Ascii      11  0000000000
526 rmills@rmillsmbp:~/Downloads $ 

Lens recognition is "non-deterministic" (it requires a guess). Exiftool doesn't know every lens either. As you reported above:

exiftool IMG_4575.CR2 | grep Lens
Lens Type : Canon EF 75-300mm f/4-5.6 IS USM or Sigma Lens
I'm rather pleased with adding the file ~/.exiv2 as it enables:

1) You can override exiv2's "built-in" lens tables
2) You don't need to wait for a new version of Exiv2
3) Your lens in ~/.exiv2 is recognised by all application that use Exiv2
4) Your "overwrite" remains valid for future releases of Exiv2
5) I get fewer issue reports about "Why does Exiv2 not recognise my brand new lens that I purchased yesterday!"

Thanks for using Exiv2.

#6 Updated by Jean-Luc Jean-Luc Coulon 11 days ago

Thanks for the "hack" that allows to have the correct value.
Nevertheless

Exif.CanonCs.LensType Short 1 Canon EF 75-300mm f/4-5.6 IS USM <--- Exiv2 "thinks" it a Canon lens
Exif.CanonCs.Lens Short 3 18.0 - 300.0 mm <==== This means that Exiv2 "thinks" the wrong way

Jean-Luc

#7 Updated by Robin Mills 11 days ago

It's not a "hack". It's feature for which I have given 5 good justifications.

The lens related metadata is stored by the manufacturer and correctly presented by Exiv2:

522 rmills@rmillsmbp:~/Downloads $ exiv2 -pv --grep lens/i IMG_4575.CR2 
0x0016 CanonCs      LensType                    Short       1  197  <---- this is the LensID
0x0017 CanonCs      Lens                        Short       3  300 18 1
0x0095 Canon        LensModel                   Ascii      74  18-300mm
0xa432 Photo        LensSpecification           Rational    4  18/1 300/1 0/1 0/1
0xa434 Photo        LensModel                   Ascii       9  18-300mm
0xa435 Photo        LensSerialNumber            Ascii      11  0000000000
We've discussed CanonCs.LensType.

CanonCs.Lens are three integers "300 18 1" - presumably the 18-300mm specification.

0x0017 CanonCs      Lens                        Short       3  300 18 1

Canon.LensModel, Photo.LensModel and Photo.LensSerialNumber are ascii strings.

0x0095 Canon        LensModel                   Ascii      74  18-300mm
0xa434 Photo        LensModel                   Ascii       9  18-300mm
0xa435 Photo        LensSerialNumber            Ascii      11  0000000000

Photo.LensSpecification are 4 rational numbers which I assume are another way of expressing 18-300mm

0xa432 Photo        LensSpecification           Rational    4  18/1 300/1 0/1 0/1

So what's the issue? What would you like to see changed?

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux