Feature #1323
Add lens "Sigma 18-300mm f/3.5-6.3 DC Macro OS HS" for Canon ID 197
100%
Description
$ exiv2 -pt IMG_6312.cr2 | grep -ai 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 70 18-300mm
Exif.Photo.LensSpecification Rational 4 18/1 300/1 0/0 0/0
Exif.Photo.LensModel Ascii 70 18-300mm
Exif.Photo.LensSerialNumber Ascii 12 0000000000
https://www.sigma-global.com/en/lenses/cas/product/contemporary/c_18_300_35_63/
Files
History
Updated by Robin Mills about 4 years ago
- Category set to lens
- Status changed from New to Assigned
- Assignee set to Robin Mills
- Target version set to 0.27
- % Done changed from 0 to 10
- Estimated time set to 2.00 h
Can you attach an image taken with this lens and I will investigate.
Updated by Robin Mills about 4 years ago
- % Done changed from 10 to 50
Thanks for the test file. The quick fix for this in Exiv2 v0.26 is to add the following to ~/.exiv2:
[canon] 197=Sigma 18-300mm f/3.5-6.3 DC Macro OS HS
Lens recognition is not simple because manufacturers often use the same lens id (in this case 197) for more than one lens. You could modify the code in src/canonmn.cpp to be:
{ 197, "Sigma 18-300mm f/3.5-6.3 DC Macro OS HS" },
However in order to permanently add the recognition of your lens, we have to provide a function such as:
{ 197, printCsLensByFocalLength }, // not testedThe function printCsLensByFocalLength has to be "tuned" to examine all the metadata in the image to distinguish your lens from another with ID = 197.
I added the file ~/.exiv2 for the following reasons:
1) You can overwrite the "built in" definition without waiting for a new release of Exiv2
2) to save me the effort to add code to determine which of several lens is in use
3) When you update your version of Exiv2, your definition in ~/.exiv2 remains valid.
Here's the documentation for this feature: http://dev.exiv2.org/projects/exiv2/wiki/Lens_Recognition_in_Exiv2_v026_(and_later)
Updated by Robin Mills about 4 years ago
- Status changed from Assigned to Closed
- % Done changed from 50 to 100
- Estimated time changed from 2.00 h to 1.00 h
I'm going to close this issue. If you wish to discuss this further, you are welcome to add comments and I will reopen the case.
If you'd like to accept the challenge of updating the code in printCsLensByFocalLength to identify your lens, I'm always looking for volunteers to join Team Exiv2. You'll find this interesting, rewarding and a little frustrating. I assure you of great mentoring and encouragement from other team members.