-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Canon lens detection (#2057) #2235
Open
postscript-dev
wants to merge
3
commits into
Exiv2:main
Choose a base branch
from
postscript-dev:fix_canon_lens_#2057
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from system_tests import CaseMeta, path | ||
|
||
class PanasonicMakerPrintAccelerometerIntOverflow(metaclass=CaseMeta): | ||
""" | ||
Regression test for the bug described in: | ||
https://github.com/Exiv2/exiv2/issues/2057 | ||
""" | ||
url = "https://github.com/Exiv2/exiv2/issues/2057" | ||
|
||
filename = path("$data_path/issue_2057_poc1.exv") | ||
commands = ["$exiv2 --Print kyyvt --key Exif.CanonCs.LensType $filename"] | ||
stderr = [""] | ||
stdout = ["""Exif.CanonCs.LensType Short 61182 Canon RF 24-105mm F4L IS USM *OR* Canon RF 24-105mm F4-7.1 IS STM | ||
"""] | ||
retval = [0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that I understand this change to use
exifAperMin
🤔From the lens description we get min & max focal length (24mm, 105mm) and we get maximum aperture at the short and tele end. (F4, F7.1)
Now if a lens is a possible match the maximum reported aperture should be between the
aperMaxShort
andaperMaxTele
.I'm not sure how
exifAperMin
which in this case is F40, would help in filtering out lenses?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hassec:
Before this PR, the values in the user's test file are:
The
Exif.CanonCs.MaxAperture
tag has a value ofF7.3
but we are expecting this to beF7.1
to fit in with the lens specification (Canon RF 24-105mm F4-7.1 IS STM
). As the value is outside the range that we are expecting, a quick fix was to change over to usingExif.CanonCs.MinAperture
instead. I realised that this would not filter much but seemed the best option available at the time.Looking again at the problem, the test file has
Exif.Photo.FNumber
atF7.1
, so the photo looks as though it was taken at the maximum aperture for the lens. From other examples,Exif.CanonCs.MaxAperture
looks as though it is usually set to the maximum value of the lens (maybeExif.CanonCs.MinAperture
is the value that the camera supports?).Perhaps the user's problem lies instead with our understanding of how Canon stores values. We calculate the
exifAperMax
variable by decoding the metadata value using:exiv2/src/canonmn_int.cpp
Lines 2814 to 2834 in 1ff0950
I have tried experimenting by reverting my commit and added an exception to the canonEv() function. The user's lens was correctly identified and a knock-on effect in another Canon test file, changed
Exif.CanonSi.ShutterSpeedValue
to be more consistent withExif.Photo.ShutterSpeedValue
.I think that this is a better solution. If you are happy with this approach, then I will make the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem of the Aperture value is that it's encoding and decoding aren't perfect, which is why we get these slightly incorrect values like 7.3 instead of 7.1.
Can you double-check how exiftool handles this specific canon transformation?
In general I'm ok with improving
canonEV
but we'd have to somehow make sure it doesn't have a negative impact on other exiv2 outputs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hassec:
I forgot to mention that with ExifTool, the user's test file also outputs
Exif.CanonCs.MaxAperture
as7.3
. On the code in git, apart from our Sigma exception, the canonEV() function looks the same on ExifTool and Exiv2.Agreed. When I ran the Exiv2 testing on my changes, only 1 problem was flagged up.
Looking at the test/data/test_reference_files/Sigma_50mm_F1.4_DG_HSM_A_for_EOS.exv.out file, I can see that it has
Although we don't have the makernotes specifications, the new
Exif.CanonSi.ShutterSpeedValue
value of1/50
is closer to theExif.Photo.ShutterSpeedValue
value of1/49
which looks like an improvement.Do you have something else that you would like me to test for?