Skip to content
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

Interpretation for Exif.Photo.LensSpecification #2422

Merged

Conversation

norbertwg
Copy link
Contributor

new method printLensSpecification is copied from old Nikon3MakerNote::print0x0084
call of Nikon3MakerNote::print0x0084 replaced by call of printLensSpecification

Exif.Photo.LensSpecification and Exif.Nikon3.Lens added to EasyAccess API

printLensSpecification is copied from old Nikon3MakerNote::print0x0084
call of Nikon3MakerNote::print0x0084 replaced by printLensSpecification
Exif.Photo.LensSpecification and Exif.Nikon3.Lens
@postscript-dev
Copy link
Collaborator

@norbertwg
Thanks for working on this, I can cross it off my list. I have a couple of suggestions.

At the beginning of printLensSpecification(), could you check that the type of the tag is correct (i.e. add value.typeId() != unsignedRational).

Could you please check that both of the lower values in Exif.Photo.LensSpecification are less than the higher values. If this is not the case, then you could output the vanilla value in ( ).

@norbertwg
Copy link
Contributor Author

@kmilos @postscript-dev
Thanks for the valuable feedback. The suggestions are sligthly different, so I would like to align the rules with you before I finalise the changes.

  • No change for the logic, if all four values are positive: output will look like "100mm F2.8", "70-300mm F4-5.6", "16-50mm F2.8".
  • In the sample pictures I found several entries, where the dividend of all four values is zero (e.g. 0/10 0/10 0/10 0/10). This I regard as indication, that no lens information is stored and suggest to print it as "n/a". I Suggest "n/a" as this is done already for several tags as well, whereas I did not find an example with "unknown" or "unspecified".
  • Some images had a dividend of zero only for the F-numbers. In this case I suggest to just print the focal length information (e.g. "35-80mm",
  • In all other cases I regard the values as wrong and suggest to print vanilla value in ( ). This includes:
    -- at least one divisor is zero
    -- wrong type
    -- wrong number of values
    -- one value for focal length is zero
    -- one value for F-number is zero
    For the last two the alternative could be to print the zero-value as "n/a" and the other value as number (e.g. "n/a-80mm"). But this looks ugly and as I found no example for them, I believe, that this can be also considered as a wrong entry.

@kmilos
Copy link
Collaborator

kmilos commented Nov 18, 2022

There is also the clear case in the Exif spec:

When the minimum F number is unknown, the notation is 0/0.

@postscript-dev
Copy link
Collaborator

@kmilos
Ahh, I was looking for the case of all zeros, not just the focal length. I am happy to go with your explanation.

@norbertwg
Copy link
Contributor Author

Rework according review is done:
Focal lenght is printed with decimal digits (if needed), e.g. the funny 807365/524263 is printed as 1.54mm.
Values where dividend is zero (0/10 and also 0/0) are regarded as unknown and will printed as "n/a".
The rule what is regareded as wrong is changed:
-- wrong type
-- wrong number of values
-- first value is bigger than second value
-- one devisor is zero where associated dividend is not zero (e.g. 7/0)

A test file is created to cover the special cases, which do not occur in regression tests. For completeness the file includes also test for the standard scenarios, which also occur in regression tests.

@codecov
Copy link

codecov bot commented Nov 19, 2022

Codecov Report

Merging #2422 (979ce8a) into main (3dd881f) will decrease coverage by 0.06%.
The diff coverage is 98.03%.

❗ Current head 979ce8a differs from pull request most recent head 10bbe3f. Consider uploading reports for the commit 10bbe3f to get more accurate results

@@            Coverage Diff             @@
##             main    #2422      +/-   ##
==========================================
- Coverage   64.64%   64.59%   -0.06%     
==========================================
  Files         119      103      -16     
  Lines       21119    22224    +1105     
  Branches    10420    10857     +437     
==========================================
+ Hits        13653    14356     +703     
- Misses       5300     5633     +333     
- Partials     2166     2235      +69     
Impacted Files Coverage Δ
src/nikonmn_int.cpp 61.22% <ø> (-0.68%) ⬇️
src/tags_int.hpp 91.34% <ø> (+0.16%) ⬆️
src/tags_int.cpp 80.11% <98.00%> (+2.36%) ⬆️
src/easyaccess.cpp 94.44% <100.00%> (+0.13%) ⬆️
src/cr2header_int.hpp 0.00% <0.00%> (-33.34%) ⬇️
include/exiv2/tags.hpp 0.00% <0.00%> (-33.34%) ⬇️
src/tiffcomposite_int.hpp 90.09% <0.00%> (-2.64%) ⬇️
src/tiffimage_int.hpp 77.77% <0.00%> (-2.23%) ⬇️
src/tags.cpp 65.74% <0.00%> (-2.10%) ⬇️
src/gifimage.cpp 34.14% <0.00%> (-0.86%) ⬇️
... and 100 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@norbertwg
Copy link
Contributor Author

Three checks are failing, in Run Conan and in Set up Cygwin, which I believe is not a result of this PR.
@postscript-dev @kmilos
Could you please finish your review, so that I can regard my changes as approved (or make the needed adjustments)?
After that somebody should decide, how to deal with the failing checks.

@postscript-dev
Copy link
Collaborator

@norbertwg

Could you please finish your review,

Unless someone else wants to, I will look at this tomorrow.

@postscript-dev postscript-dev added the enhancement feature / functionality enhancements label Nov 27, 2022
@norbertwg
Copy link
Contributor Author

This pull request waits for approving review. According to my understanding, all review comments so far are covered - or is something still missing from my side?

@postscript-dev
Copy link
Collaborator

@norbertwg

This pull request waits for approving review. According to my understanding, all review comments so far are covered - or is something still missing from my side?

Sorry for not looking at this sooner, recently I haven't worked much on open source projects. Unless someone else wants to, I will try and find some time to review this in the next couple of days.

@neheb
Copy link
Collaborator

neheb commented Mar 5, 2023

needs rebase

printLensSpecification is copied from old Nikon3MakerNote::print0x0084
call of Nikon3MakerNote::print0x0084 replaced by printLensSpecification

add two lens tags to EasyAccess API
Exif.Photo.LensSpecification and Exif.Nikon3.Lens

handling of zero; more precision for focal length

silence compiler warnings
@norbertwg
Copy link
Contributor Author

@neheb
Rebase is done; as it was my first, I hope I have done it correct.

@neheb
Copy link
Collaborator

neheb commented Mar 7, 2023

need to push it.

git push --force

@postscript-dev
Copy link
Collaborator

Copy link
Collaborator

@piponazo piponazo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me.

@neheb mentioned that the PR needs to be rebased, so I will leave for him the final approval. I have been a long time without contributing actively to the project and I might be missing something.

src/tags_int.cpp Outdated
os << "-" << len2;
// values numerically are ok, so they can be converted
// here first and second can be zero, so initialise float with 0.0
float focalLength1 = 0.0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggestion] Some compilers at certain warning levels would complain about not using the same types here (float variable vs double literals). Could you replace those 0.0 with 0.0F when comparing or assigning float variables?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

valid point, I changed it.

@ghost
Copy link

ghost commented Mar 7, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@norbertwg
Copy link
Contributor Author

@postscript-dev : thanks for the useful link
@neheb : push is done

@neheb neheb merged commit ff7bfb3 into Exiv2:main Mar 7, 2023
@norbertwg norbertwg deleted the interpretation-for-Exif.Photo.LensSpecification branch July 30, 2023 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature / functionality enhancements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants