Project

General

Profile

Feature #1140

Canon EF-S 24mm f/2.8 STM

Added by Anonymous Poster almost 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
makernote
Target version:
Start date:
20 Dec 2015
Due date:
% Done:

100%

Estimated time:
4.00 h

Description

This lens appears to be in the latest canonmn.cpp with tag value 4154, but my camera (Canon EOS 30D) with the lens doesn't report this tag value, instead reporting 65535 (hex FF FF) which isn't associated with the any lens name. exiftool also reports a generic 'Unknown 24mm' Lens ID, so maybe there isn't enough information provided to correctly determine this lens on this camera.


Files

IMG_5604.JPG (262 KB) IMG_5604.JPG Sample picture Anonymous Poster, 20 Dec 2015 00:46
IMG_5604.JPG.output (12.7 KB) IMG_5604.JPG.output Output of exiv2 -pt Anonymous Poster, 20 Dec 2015 00:46

Associated revisions

Revision 4133 (diff)
Added by Robin Mills almost 6 years ago

#1140 Fix submitted.

Revision 4134 (diff)
Added by Robin Mills almost 6 years ago

#1140. Correction to r4132. Modified lens detection condition.

History

#1

Updated by Robin Mills almost 6 years ago

  • Category changed from lens to makernote
  • Status changed from New to Assigned
  • Assignee set to Robin Mills
  • Priority changed from Low to Normal
  • Target version set to 0.26
  • Estimated time set to 4.00 h

Thanks for reporting this. Niels, our wonderful King Makernotes has gone back to college (in addition to his full-time demanding job) and I've taken over this challenge. So .... patience ...... I'm on a learning curve. However I've solved a couple of challenges and so I am optimistic of success.

There was an issue with a Sigma Lens on a Pentax in which the LensID=0xffff (-1). The lens detection required a "heuristic" to differentiate several types of lens with LensID == -1 and Phil (of ExifTool) explained it and we got that resolved. I prefer the term magic to "heuristic". The magic is some code that sniffs parts of the metadata to deduce how some tags are reported.

Thanks for the test image. Here's what I see on the trunk:

$ exiv2 --grep lens/i -pa http://dev.exiv2.org/attachments/download/866/IMG_5604.JPG 
Exif.CanonCs.LensType                        Short       1  (65535)
Exif.CanonCs.Lens                            Short       3  24.0 mm
Exif.CanonCf.LensAFStopButton                Short       1  2304
Exif.Canon.LensModel                         Ascii      64  
I've run this through exiftool:
$ curl --silent -O http://dev.exiv2.org/attachments/download/866/IMG_5604.JPG
$ exiftool IMG_5604.JPG | grep -i lens
PrintLensID begin
PrintLensID B
Lens Type                       : n/a
Lens AF Stop Button             : AF stop
Lens Model                      : 
Lens                            : 24.0 mm
Lens ID                         : Unknown 24mm
Lens                            : 24.0 mm (35 mm equivalent: 38.4 mm)
I don't see a lot of difference. Exiftool reports Lens Type : n/a and we report -1. And about the same with LensAFStopButton. "Lens Model" is empty on both outputs.

Looking in the code, I've found the 4154 which is associated with your lens.

$ grep EF src/canonmn.cpp  | grep 24 | grep STM
        { 4152,"Canon EF 24-105mm f/3.5-5.6 IS STM"                         },
        { 4154,"Canon EF-S 24mm f/2.8 STM"                                  }
However 4154 is not in your metadata. Here's what I see (printing the 'vanilla' values):
$ exiv2 --grep Lens/i -pv http://dev.exiv2.org/attachments/download/866/IMG_5604.JPG
0x0016 CanonCs      LensType                    Short       1  65535
0x0017 CanonCs      Lens                        Short       3  24 24 1
0x0009 CanonCf      LensAFStopButton            Short       1  2304
0x0095 Canon        LensModel                   Ascii      64  
There must be existing magic in the code to convert 'CanonCs.Lens from 'Short 3 24 24 1' to '24.0 mm'. However I don't see any data to explicitly identify it as Canon EF-S 24mm f/2.8 STM. I see there are tags which are probably unique to your camera.
610 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pa --grep Model/i --grep Lens/i  --grep Firm/i IMG_5604.JPG  
Exif.Image.Model                             Ascii      14  Canon EOS 30D
Exif.CanonCs.LensType                        Short       1  (65535)
Exif.CanonCs.Lens                            Short       3  24.0 mm
Exif.Canon.FirmwareVersion                   Ascii      32  Firmware 1.0.5
Exif.CanonCf.LensAFStopButton                Short       1  2304
Exif.Canon.ModelID                           Long        1  EOS 30D
Exif.Canon.LensModel                         Ascii      64  
611 rmills@rmillsmbp:~/gnu/exiv2/trunk $ 
Here's my proposal:
1) I cannot modify Exif.Canon.LensModel as we are correctly reporting it as 64 bytes with nothing in it.
2) I can modify the magic that converts Short 3 24 24 1 into '24.0 mm', provided:

a) Image.Model is Canon EOS 30D
b) Canon.FirmwareVersion is 1.0.5
c) This change does not break our test suite.

Are you happy with my proposal?

#2

Updated by Robin Mills almost 6 years ago

  • % Done changed from 0 to 80

Fix submitted r4133 and r4134.

The important part of the fix is in src/canonmn.cpp#1588:

// 1140
if( metadata->findKey(ExifKey("Exif.Image.Model"        ))->value().toString() == "Canon EOS 30D" 
&&  metadata->findKey(ExifKey("Exif.CanonCs.Lens"       ))->value().toString() == "24 24 1" 
&&  metadata->findKey(ExifKey("Exif.CanonCs.MaxAperture"))->value().toString() == "95" // F2.8
){
    return os << "Canon EF-S 24mm f/2.8 STM" ;
}
May I ask you to build and run this code on a collection of images taken with this camera + lens combination.

I have extracted the metadata from your test image and added it to our test suite for regression purposes. Please let me know if you are unhappy with your data being used in this way.

#3

Updated by Eric Brown almost 6 years ago

It seems to work on a collection of pictures that I took on a couple separate days. There also appears to be a "Canon EF 24mm f/2.8 IS" lens for sale )(http://www.bhphotovideo.com/c/product/843009-USA/Canon_5345B002_EF_24mm_f_2_8L_IS.html). I'm not sure how its EXIF data differs or whether it would be incorrectly assigned to the non-image-stabilized USM lens. I don't have access to that lens.

After some further investigating, it appears as though the firmware version that I have (1.0.5) doesn't store the lens type for any lens that I have but that the updated firmware (1.0.6) does store it. I haven't tried to update the Firmware or see what happens, but perhaps the patch should include a check for the 1.0.5 firmware, since the magic (hopefully) isn't needed for an update camera.

#4

Updated by Robin Mills almost 6 years ago

Gosh, Eric. I'm learning as we go here. If it's working on your files, let's leave it be and not include the firmware check. When I added the code yesterday I thought "oh, the firmware could be updated and break this code.". So let's not try to forward guess the firmware.

The real fix is for Canon to use LensID == 4154 and then my magic will not be executed. Perhaps the 1.06 firmware will do exactly that and my magic is irrelevant.

I've marked this 80% complete. If a firmware change (or the non-stabilised version of the lens) causes an unhappy change in behaviour, please let me know (with test files) and I will investigate and remedy this situation.

If you're happy with my response, you'll see the bill I presented to Simon for helping him with 816: http://dev.exiv2.org/issues/816#note-39

Happy Holidays. Seasons Greetings.

#5

Updated by Robin Mills almost 6 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 80 to 100

As there has been no further incidents, I'm going to close this and mark it 100% resolved.

Also available in: Atom PDF