Feature #816

Enable detection of Sigma 55-200mm lens

Added by Simon Harhues over 5 years ago. Updated over 1 year ago.

Status:ClosedStart date:18 Mar 2012
Priority:NormalDue date:
Assignee:Robin Mills% Done:

100%

Category:lensEstimated time:17.00 hours
Target version:0.26

Description

exiv2 doesn't detect my Sigma lens right.
Following output:

simon@laptop:~/fotos$ exiv2 -pt 12-03-05_thinkpad_tastatur/IMGP4432.PEF | grep -i lens
Exif.Pentax.LensType Byte 2 SIGMA
Exif.Pentax.LensInfo Undefined 36 3 255 0 0 40 148 71 152 80 6 241 65 237 153 88 36 1 76 107 251 255 255 255 0 0 80 6 241 0 0 0 0 0 0 0 0

simon@laptop:~/fotos$ exiftool 12-03-05_thinkpad_tastatur/IMGP4432.PEF | grep -i lens
Lens Type : Sigma Lens (3 255)
Lens F Stops : 8.5
Lens ID : Sigma 55-200mm F4-5.6 DC

I'll will attach the raw file if you need more information.

IMGP4432.PEF - raw file taken with a Sigma 55-200mm lens (9.96 MB) Simon Harhues, 18 Mar 2012 15:39

pentaxmn.cpp.diff Magnifier (12.1 KB) Abhinav Badola, 26 Mar 2012 14:19

pentaxmn.cpp.diff2 (14.1 KB) Abhinav Badola, 13 Apr 2012 13:17

pentaxmn.cpp.diff3 (13.6 KB) Abhinav Badola, 15 Apr 2012 04:21

pentaxmn.cpp.diff4 (14.1 KB) Abhinav Badola, 25 Apr 2012 22:14

_IGP9032.DNG - DNG K10 Sigma 55-200 (16 MB) Simon Harhues, 12 Nov 2015 22:02

_IGP9033.PEF - PEF K10 Sigma 55-200 (11.8 MB) Simon Harhues, 12 Nov 2015 22:02

_IGP9034.JPG - JPEG K10 Sigma 55-200 (3.09 MB) Simon Harhues, 12 Nov 2015 22:02

IMGP2221.JPG - example picture with Pentax K3 (9.36 MB) Simon Harhues, 20 Dec 2015 20:15


Related issues

Related to Exiv2 - Bug #1143: Unable to extract embedded preview from jpg for Sony a77 Closed 24 Dec 2015
Related to Exiv2 - Feature #1145: Respect Sony/Minolta lenses with shared LensID such as Ta... Closed 27 Dec 2015

Associated revisions

Revision 4012
Added by Robin Mills almost 2 years ago

#816. This is the framework from Abhinav's patch from which we can derive the fix. Explanation in issue report.

Revision 4013
Added by Robin Mills almost 2 years ago

#816 Added Phil's Perl code PrintLensID (see issue report). I'll have to convert this into C++ and then report the output.

Revision 4014
Added by Robin Mills almost 2 years ago

#816. Correction to 4012. Fix msvc build breaker

Revision 4016
Added by Robin Mills almost 2 years ago

#816. Fix submitted. Will ask Simon to test this ask his permission to use his metadata in the test suite.

Revision 4018
Added by Robin Mills almost 2 years ago

#816. Fix submitted. Thank you Simon for working with me on this and for providing test files.

Revision 4019
Added by Robin Mills almost 2 years ago

#816 Correction to r4018 to deal with segmentation fault on test file _IGP9034.JPG

Revision 4135
Added by Robin Mills almost 2 years ago

#816. Fix for Pentax K-3 Camera.

Revision 4136
Added by Robin Mills almost 2 years ago

#816. Correction to msvc buildbreaker in r4135

History

#1 Updated by Andreas Huggel over 5 years ago

  • Category set to metadata
  • Assignee set to Abhinav Badola
  • Target version set to 0.23

#2 Updated by Abhinav Badola over 5 years ago

I tried but was not able to crack the mechanism to detect the proper LensInfo.
For now this is a patch in which I have added all the lens listed in the exiftool Pentax information.

#3 Updated by Abhinav Badola over 5 years ago

Here is another updated patch to the same issue. I have called a function "printPentaxLensType" for handling, additional lens information. As such the framework is still incomplete, so it still needs some more work to be done later.

#4 Updated by Abhinav Badola over 5 years ago

A revised patch.

#5 Updated by Andreas Huggel over 5 years ago

  • Target version deleted (0.23)

#6 Updated by Abhinav Badola over 5 years ago

Added another function resolvePentaxLensType, to print/detect correct lens.

#7 Updated by Robin Mills about 4 years ago

  • Status changed from New to Assigned
  • Target version set to 0.25

Deferred for 0.25

#8 Updated by Robin Mills over 2 years ago

Abhinav

I think you have dealt with this - however the code isn't in the repos.

626 rmills@rmillsmbp:~/gnu/exiv2/trunk/samples $ exiv2 -pa -g Lens ~/Downloads/IMGP4432.PEF 
Exif.Pentax.LensType                         Byte        2  Sigma Lens
Exif.Pentax.LensInfo                         Undefined  36  3 255 0 0 40 ...
627 rmills@rmillsmbp:~/gnu/exiv2/trunk/samples $ 
I see you've provided 4 patches. I'm not sure if they are to be applied one at a time or if the 4th is all that is required.

Perhaps you could revisit this and submit what's required to the trunk and add a test to test/bugfixes-test.sh Thanks.

#9 Updated by Alan Pater over 2 years ago

  • Category changed from metadata to lens
  • Target version changed from 0.25 to 0.26

#10 Updated by Simon Harhues almost 2 years ago

Just wanted to ask for the current state as I still use the lens... :)

#11 Updated by Robin Mills almost 2 years ago

  • Assignee changed from Abhinav Badola to Robin Mills

Simon

I'm very surprised we haven't dealt with this. It has inexplicably "slipped over the side". My apologies. The output from exiv2 is still the same as I reported 7 months ago. I see exiftool knows about this:

517 rmills@rmillsmbp:~/Downloads $ exiftool IMGP4432.PEF | grep Lens
Lens Type                       : Sigma Lens (3 255)
Lens F Stops                    : 8.5
Lens Focal Length               : 147.5 mm
Lens ID                         : Sigma 55-200mm F4-5.6 DC
518 rmills@rmillsmbp:~/Downloads $ 

Our team member who dealt with makernotes has returned to college and I've agreed to deal with makernotes. There's quite a learning curve for me, so I ask for your patience while I work on this.

#12 Updated by Simon Harhues almost 2 years ago

Robin, Thanks for your kind reply. Looking forward to be able to use it in darktable (automatically) one day.

#13 Updated by Robin Mills almost 2 years ago

Simon

I'm working on it right now. Abhinav provided a patch a couple of years ago for this. It's totally non-trivial patch. I'm going to get it to work against the code at that time, then figure out how to drag it into the current code base.

#14 Updated by Simon Harhues almost 2 years ago

Thanks for your effort! :)

#15 Updated by Robin Mills almost 2 years ago

Ungood news. I've applied the patch to r2718 (v0.23) and here's the output:

565 rmills@rmillsmbp:~/gnu/exiv2/trunk.2718 $ exiv2 -V
exiv2 0.23 001700 (64 bit build)
Copyright (C) 2004-2012 Andreas Huggel.

This program is .... deleted ....
Boston, MA 02110-1301 USA
566 rmills@rmillsmbp:~/gnu/exiv2/trunk.2718 $ exiv2 -pa ~/Downloads/IMGP4432.PEF | grep Lens
Exif.Pentax.LensType                         Byte        2  SIGMA
Exif.Pentax.LensInfo                         Undefined  36  3 255 0 0 40 ...
567 rmills@rmillsmbp:~/gnu/exiv2/trunk.2718 $ svn info .
Path: .
Working Copy Root Path: /Users/rmills/gnu/exiv2/trunk.2718
URL: svn://dev.exiv2.org/svn/trunk
Relative URL: ^/trunk
Repository Root: svn://dev.exiv2.org/svn
Repository UUID: b7c8b350-86e7-0310-a4b4-de8f6a8f16a3
Revision: 2718
Node Kind: directory
Schedule: normal
Last Changed Author: robinwmills
Last Changed Rev: 2718
Last Changed Date: 2012-04-22 08:21:02 +0100 (Sun, 22 Apr 2012)
568 rmills@rmillsmbp:~/gnu/exiv2/trunk.2718 $ 
For sure, I'm not going to retrofit a 3 year old complex patch with unknown side effects. I'm going to have to put on my scuba kit, dive in and figure how this code works. Then I will fix it "properly".

Oh, how I miss Niels. He was such a great pair of hands in dealing with MakerNotes.

The patch calls Abhinav's new function printPentaxLensType(). For sure there's something to debug here. There's always hope!

#16 Updated by Robin Mills almost 2 years ago

I've made good progress with this. The reason for this issue is that there are many lenses which share the same ID (0x03ff) in pentaxmn.cpp#756

        { 0x03ff, "Sigma Lens" },                    //0
        { 0x03ff, "Sigma 18-200mm F3.5-6.3 DC" },            //1
        { 0x03ff, "Sigma DL-II 35-80mm F4-5.6" },            //2
        { 0x03ff, "Sigma DL Zoom 75-300mm F4-5.6" },            //3
        { 0x03ff, "Sigma DF EX Aspherical 28-70mm F2.8" },        //4
        { 0x03ff, "Sigma AF Tele 400mm F5.6 Multi-coated" },        //5
        { 0x03ff, "Sigma 24-60mm F2.8 EX DG" },                //6
        { 0x03ff, "Sigma 70-300mm F4-5.6 Macro" },            //7
        { 0x03ff, "Sigma 55-200mm F4-5.6 DC" },                //8
        { 0x03ff, "Sigma 18-50mm F2.8 EX DC" },                //9
        { 0x03ff, "Sigma 18-50mm F2.8 EX DC Macro" },            //10
To differentiate, the code has to provide a function "resolveLensType". The default version of that is in the patch, however it's effectively empty and defaults to the first entry with that lensID. So the code says "Sigma Lens".

resolveLensType has access to all the metadata in the file which of course includes the information:

0x003f Pentax       LensType                    Byte        2  3 255
0x0207 Pentax       LensInfo                    Undefined  36  3 255 0 0 40 148 ...
So the recipe for the fix is to provide a working "resolveLensType" which would read the key Exif.Pentax.LensInfo. In there lies the secret. Regrettably the URL to the maker notes concerning Pentax is no longer valid - so I don't know how to decode the LensInfo record which would enable us to be certain it's your lens!

from page: http://www.exiv2.org/makernote.html Reference 11
broken link: http://www.gvsoft.homedns.org/exif/makernote-pentax-type3.html

There's another minor issue that the code to actually do the printing is a tricky little MACRO that uses a C++ Template. A little head buster.

There are a couple of ways in which you could help:
1 Can you look at the key Exif.Pentax.LensInfo in lots of images
If it's always an array of the 36 integers above, that's fine. Or is there a subset that's the same in every image?

2 Can you have a google to see if you can find the current location of the Pentax MakerNote Spec?
There might be something on Phil's (he of exiftool fame) web site

I'm going to give up for today (it's 8:20pm in England). This is very interesting. I've learned a lot today about a part of the code in which I've hardly worked. I'm confident of success - however not tonight. I'd like to acknowledge and thank Abhinav for the work he did on this. Although he hasn't fixed it, his changes and comments in the code have revealed the road to the fix.

#17 Updated by Robin Mills almost 2 years ago

  • % Done changed from 0 to 50
  • Estimated time set to 12.00

#18 Updated by Robin Mills almost 2 years ago

I'm adding Phil to the watchers for this issue.

Phil:
Can you help me please? I can see on your web-site http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Pentax.html that the lens-ID is listed as:

'3 255.8'    = Sigma 55-200mm F4-5.6 DC
And this aligns perfectly with our code above.

What is 'Composite LensID tag'?

#19 Updated by Phil Harvey almost 2 years ago

The ExifTool Composite tags are derived from the values of other tags, and are documented here: http://owl.phy.queensu.ca/~phil/exiftool/TagNames/Composite.html

The Composite LensID tag is an attempt to identify the lens using LensType and a number of other tags, specifically FocalLength, MaxAperture, MaxApertureValue, MinFocalLength, MaxFocalLength, LensModel, LensFocalRange, LensSpec, LensType2 and LensFocalLength.

The actual logic to do this is somewhat convoluted, but may be found at line 3582 here: https://sourceforge.net/p/exiftool/code/ci/master/tree/lib/Image/ExifTool/Exif.pm

#20 Updated by Robin Mills almost 2 years ago

Thank You, Phil. What a helpful person you are. If you're visiting England, we'd be honoured by a visit (and we're offering free dinner, bed and breakfast). We're 40km from Heathrow Airport. http://dev.exiv2.org/projects/exiv2/wiki/_Robin_Mills_

I was very interested in a comment you made on your website about the undocumented nature of maker notes. It serves everybody's interest to share this information freely. The success of the internet is, in no small measure, due to its public development and RFCs. Apache is a miracle in the computer industry which loves competition, confusion, brand-loyalty and other business goals which are not compatible with cooperation. The camera business is even less interested in sharing. A huge Vote of Thanks to you for all your work to shine a light into this pit of darkness.

#21 Updated by Phil Harvey almost 2 years ago

Glad to help. Thanks for the offer.

#22 Updated by Robin Mills almost 2 years ago

  • % Done changed from 50 to 80

Fix submitted: r4016.

Simon:
Two questions:
1 Can you build and test this on the trunk
With wonderful input from Phil, I can now figure out that it's your lens from the data in Exif.Pentax.LensInfo (explanation below). However, it's a bit of a guess.

2 May I have your permission to extract the metadata from the test file IMPG4432.PEF into test/data/exiv2-bug816.exf. I add a regression detector to test/bugfixes-test.sh

About the fix

if ( lensID == 0x3ff ) { // lensType Sigma
    unsigned long base   = 1;

    // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Pentax.html#LensData
    const ExifData::const_iterator lensInfo = metadata->findKey(ExifKey("Exif.Pentax.LensInfo"));
    if ( lensID == 0x3ff && lensInfo->count() > 5 ) {
        unsigned int  autoAperture     = lensInfo->toLong(base+1) & 0x01 ;
        unsigned int  minAperture      = lensInfo->toLong(base+2) & 0x06 ;
        unsigned int  minFocusDistance = lensInfo->toLong(base+3) & 0xf8 ;

        if ( autoAperture == 0x0 && minAperture == 0x0 && minFocusDistance == 0x28 ) index = 8;
    }
}
Phil's Perl function contains lots of magic for many lens types. I decided to simplify the whole thing to this test:

if lensID = 0x3ff and AutoAperture etc are set OK, it's a Sigma 55-200mm which is index +8 in the find(pentaxLensType,0x377) array.

I can make the test more robust when I have examples of Exif.Pentax.LensInfo for your lens.

#23 Updated by Simon Harhues almost 2 years ago

I had a look at the LensInfo at different images, it is indeed different, only the first 8 ints seem to be always the same:

simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8633.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 64 78 128 70 244 65 89 136 88 61 1 64 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8635.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 68 245 128 70 244 65 93 136 88 61 1 66 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8636.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 69 117 128 38 244 65 137 136 88 58 1 68 107 251 255 255 255 0 0 128 38 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8637.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 69 165 128 38 244 65 117 136 88 57 1 67 107 251 255 255 255 0 0 128 38 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8638.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 64 78 128 70 244 65 89 136 88 61 1 64 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8640.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 64 152 80 6 241 65 237 153 88 36 1 76 107 251 255 255 255 0 0 80 6 241 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8641.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 64 152 80 6 241 65 237 153 88 36 1 76 107 251 255 255 255 0 0 80 6 241 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8642.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 64 101 128 6 244 65 153 153 88 58 1 69 107 251 255 255 255 0 0 128 6 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8643.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 64 244 112 6 243 65 197 153 88 35 1 73 107 251 255 255 255 0 0 112 6 243 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8644.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 69 81 128 6 244 65 165 153 88 54 1 71 107 251 255 255 255 0 0 128 6 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8645.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 64 88 48 6 239 65 82 170 88 42 1 80 107 251 255 255 255 0 0 48 6 239 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8646.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 64 88 48 6 239 65 82 170 88 42 1 80 107 251 255 255 255 0 0 48 6 239 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8647.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 64 104 64 6 240 65 74 170 88 42 1 79 107 251 255 255 255 0 0 64 6 240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8648.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 64 88 48 6 239 65 82 170 88 42 1 80 107 251 255 255 255 0 0 48 6 239 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8649.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 69 78 128 70 244 65 89 136 88 61 1 64 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8650.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 64 152 80 6 241 65 237 153 88 36 1 76 107 251 255 255 255 0 0 80 6 241 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8651.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 69 88 48 6 239 65 82 170 88 42 1 80 107 251 255 255 255 0 0 48 6 239 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8652.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 64 88 48 6 239 65 82 170 88 42 1 80 107 251 255 255 255 0 0 48 6 239 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8653.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 64 124 80 6 240 65 66 170 88 38 1 78 107 251 255 255 255 0 0 80 6 240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8654.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 65 152 80 6 241 65 237 153 88 36 1 76 107 251 255 255 255 0 0 80 6 241 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8655.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 69 117 128 38 244 65 137 136 88 58 1 68 107 251 255 255 255 0 0 128 38 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8656.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 69 117 128 38 244 65 137 136 88 58 1 68 107 251 255 255 255 0 0 128 38 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8657.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 71 101 128 6 244 65 153 153 88 58 1 69 107 251 255 255 255 0 0 128 6 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8658.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 65 141 128 38 244 65 125 136 88 57 1 68 107 251 255 255 255 0 0 128 38 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8661.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 69 229 128 70 244 65 101 136 88 61 1 66 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8662.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 69 201 128 70 244 65 109 136 88 59 1 67 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8663.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 69 201 128 70 244 65 109 136 88 59 1 67 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8664.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 69 201 128 70 244 65 109 136 88 59 1 67 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8665.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 69 201 128 70 244 65 109 136 88 59 1 67 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8666.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 69 201 128 70 244 65 109 136 88 59 1 67 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8667.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 69 201 128 70 244 65 109 136 88 59 1 67 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8668.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 69 201 128 70 244 65 109 136 88 59 1 67 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8669.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 69 201 128 70 244 65 109 136 88 59 1 67 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8670.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 64 245 128 70 244 65 93 136 88 61 1 66 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8671.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 64 78 128 70 244 65 89 136 88 61 1 64 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8672.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 65 78 128 70 244 65 89 136 88 61 1 64 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8673.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 68 78 128 70 244 65 89 136 88 61 1 64 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8674.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 71 196 96 6 242 65 213 153 88 38 1 75 107 251 255 255 255 0 0 96 6 242 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8675.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 65 152 80 6 241 65 237 153 88 36 1 76 107 251 255 255 255 0 0 80 6 241 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8676.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 64 152 80 6 241 65 237 153 88 36 1 76 107 251 255 255 255 0 0 80 6 241 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:~/fotos/15-10-18_tongeren_antikmarkt$ exiv2 -pt _IGP8677.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 66 244 112 6 243 65 197 153 88 35 1 73 107 251 255 255 255 0 0 112 6 243 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Robin Mills wrote:

2 May I have your permission to extract the metadata from the test file IMPG4432.PEF into test/data/exiv2-bug816.exf. I add a regression detector to test/bugfixes-test.sh

Yes, you're welcome to use the meta data from that file for the exiv2 project.

I'll see if I'm able to build the current trunk to test.

#24 Updated by Robin Mills almost 2 years ago

Simon

This seems a little different. You're operating on a DNG and the LensInfo stuff is coming from the tag Exif.PentaxDng.LensInfo Can you share one of your DNGs as I think I'll have to fix the code to respect that also. Here's what I have:

937 rmills@rmillsmbp:~/gnu/gexiv2 $ exiv2 -pa --grep LensInfo ~/Downloads/IMGP4432.PEF 
Exif.Pentax.LensInfo                         Undefined  36  3 255 0 0 40 148 71 152 80 6 241 65 237 153 88 36 1 76 107 251 255 255 255 0 0 80 6 241 0 ...
938 rmills@rmillsmbp:~/gnu/gexiv2 $ 
And you're showing:
exiv2 -pt _IGP8677.DNG | grep LensInfo
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 66 244 112 6 243 65 197 153 88 35 1 73 107 251 255 255 255 0 0 112 6 243 0 ...
We're almost there.

#25 Updated by Simon Harhues almost 2 years ago

Oh yeah. Didn't pay attention to it. I did upgrade the body from an ist*DL to a K10. I'll upload one PNG, PEF, and JPEG each, to have files to compare.

#26 Updated by Simon Harhues almost 2 years ago

The exiv2 output for the three files:

simon@laptop:/media/simon/sd16/DCIM/100PENTX$ exiv2 -pt _IGP9032.DNG | grep Lens
Exif.PentaxDng.LensType                      Byte        3  Sigma Lens
Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 68 244 112 6 243 65 197 153 88 35 1 73 107 251 255 255 255 0 0 112 6 243 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:/media/simon/sd16/DCIM/100PENTX$ exiv2 -pt _IGP9033.PEF | grep Lens
Exif.Pentax.LensType                         Byte        3  Sigma Lens
Exif.Pentax.LensInfo                         Undefined  69  131 0 0 255 0 40 148 68 244 112 6 243 65 197 153 88 35 1 73 107 251 255 255 255 0 0 112 6 243 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@laptop:/media/simon/sd16/DCIM/100PENTX$ exiv2 -pt _IGP9034.JPG | grep Lens
Exif.Pentax.LensType                         Byte        3  Sigma Lens
Exif.Pentax.LensInfo                         Undefined  69  131 0 0 255 0 40 148 68 244 112 6 243 65 197 153 88 35 1 73 107 251 255 255 255 0 0 112 6 243 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

#27 Updated by Robin Mills almost 2 years ago

Thanks, Simon. I'll have a look at your files tomorrow (it's 22:18 here, so I'm off to bed). I'm very confident we'll get this done'n'dusted tomorrow.

Can you confirm that these images were acquired using the same lens and camera as IMGP4432.PEF ?

#28 Updated by Simon Harhues almost 2 years ago

I'm one hour ahead of you. :) So 7am for me now.
The three new images were taken with the same lens (Sigma 55-200mm F4-5.6 DC) but with a different body (Pentax K10). The file IMGP4432.PEF was taken with an Pentax ist*DL.

#29 Updated by Simon Harhues almost 2 years ago

I just had a quick look in my archive, here is some exiv2 output for images taken with the Pentax Ist*DL and the Sigma 55-200 lens:

simon@laptop:12-03-24_regenbogen_veste_oberhaus$ exiv2 -pt IMGP4466.PEF | grep Lens
Exif.Pentax.LensType                         Byte        2  Sigma Lens
Exif.Pentax.LensInfo                         Undefined  36  3 255 0 0 40 148 67 78 128 70 244 65 89 136 88 61 1 64 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0
simon@laptop:12-03-24_regenbogen_veste_oberhaus$ exiv2 -pt IMGP4467.PEF | grep Lens
Exif.Pentax.LensType                         Byte        2  Sigma Lens
Exif.Pentax.LensInfo                         Undefined  36  3 255 0 0 40 148 67 201 128 70 244 65 109 136 88 59 1 67 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0
simon@laptop:12-03-24_regenbogen_veste_oberhaus$ exiv2 -pt IMGP4468.PEF | grep Lens
Exif.Pentax.LensType                         Byte        2  Sigma Lens
Exif.Pentax.LensInfo                         Undefined  36  3 255 0 0 40 148 67 78 128 70 244 65 89 136 88 61 1 64 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0
simon@laptop:12-03-24_regenbogen_veste_oberhaus$ exiv2 -pt IMGP4478.PEF | grep Lens
Exif.Pentax.LensType                         Byte        2  Sigma Lens
Exif.Pentax.LensInfo                         Undefined  36  3 255 0 0 40 148 67 88 48 6 239 65 82 170 88 42 1 80 107 251 255 255 255 0 0 48 6 239 0 0 0 0 0 0 0 0
simon@laptop:12-03-24_regenbogen_veste_oberhaus$ exiv2 -pt IMGP4479.PEF | grep Lens
Exif.Pentax.LensType                         Byte        2  Sigma Lens
Exif.Pentax.LensInfo                         Undefined  36  3 255 0 0 40 148 67 78 128 70 244 65 89 136 88 61 1 64 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0
simon@laptop:12-03-24_regenbogen_veste_oberhaus$ exiv2 -pt IMGP4480.PEF | grep Lens
Exif.Pentax.LensType                         Byte        2  Sigma Lens
Exif.Pentax.LensInfo                         Undefined  36  3 255 0 0 40 148 67 117 128 38 244 65 137 136 88 58 1 68 107 251 255 255 255 0 0 128 38 244 0 0 0 0 0 0 0 0
simon@laptop:12-03-24_regenbogen_veste_oberhaus$ exiv2 -pt IMGP4481.PEF | grep Lens
Exif.Pentax.LensType                         Byte        2  Sigma Lens
Exif.Pentax.LensInfo                         Undefined  36  3 255 0 0 40 148 67 88 48 6 239 65 82 170 88 42 1 80 107 251 255 255 255 0 0 48 6 239 0 0 0 0 0 0 0 0
simon@laptop:12-03-24_regenbogen_veste_oberhaus$ exiv2 -pt IMGP4482.PEF | grep Lens
Exif.Pentax.LensType                         Byte        2  Sigma Lens
Exif.Pentax.LensInfo                         Undefined  36  3 255 0 0 40 148 67 117 128 38 244 65 137 136 88 58 1 68 107 251 255 255 255 0 0 128 38 244 0 0 0 0 0 0 0 0

#30 Updated by Robin Mills almost 2 years ago

Thanks, Simon. Thanks for sending the extra files. The ones from Thursday have 69 bytes in the LensInfo and todays have 36. Different camera body - that explains that.

I have to go off to do a few errands today. I will look at this when I return. Very optimistic that we will get to closure on this today.

#31 Updated by Robin Mills almost 2 years ago

Fix submitted. r4018 and r4019 Thank You, Simon for working with me on this and for providing test data.

Simon:
May I ask you to build the HEAD of trunk (r4019 or later) and run some tests.

I doubt if we have seen the last of this issue. The fix is based on detecting the Sigma Lens then inspecting the LensInfo to say "is this Simon's Lens?". And we've only used files from two camera bodies using this lens. Perhaps you know somebody with another model of Pentax camera.

I understand you want to use this in Darkroom. If you wish to rebuild the libexiv2 shared object with this fix, you'll probably have to patch an unmodified 0.25 with pentaxmn.cpp/r4019 and rebuild. The API of libexiv2.so/trunk is not binary compatible with libexiv2.so/0.25. I don't think simply copying a trunk build of the libexiv2 shared object will work. I can build the appropriate library on Ubuntu if required.

You have to replace the copy of libexiv2.so used by Darkroom. You might need to use a system monitor to inspect Darkroom to determine the path to the libexiv2.so in use.

#32 Updated by Robin Mills almost 2 years ago

Simon

I've built a 'vanilla' v0.25 and copied in trunk/src/pentaxmn.cpp. It builds on the Mac and passes the v0.25 test suite. Yeah!

1237 rmills@rmillsmbp:~/gnu/exiv2/0.25 $ exiv2 --verbose --version --grep svn
exiv2 0.25 001900 (64 bit build)
svn=0
1238 rmills@rmillsmbp:~/gnu/exiv2/0.25 $ 
svn = 0 is a tar-ball build! So this fix hasn't introduced any bad side-effects.
1240 rmills@rmillsmbp:~/gnu/exiv2/0.25 $ svn export svn://dev.exiv2.org/svn/tags/0.25/test
....
1241 rmills@rmillsmbp:~/gnu/exiv2/0.25 $ make tests
.....
all testcases passed.
Your test files are working fine on this build.
1237 rmills@rmillsmbp:~/gnu/exiv2/0.25 $ exiv2 -pa --grep Lens ~/Downloads/IMGP4432.PEF 
Exif.Pentax.LensType                         Byte        2  Sigma 55-200mm F4-5.6 DC
Exif.Pentax.LensInfo                         Undefined  36  3 255 0 0 40 148 ...
1239 rmills@rmillsmbp:~/gnu/exiv2/0.25 $ exiv2 -pa --grep Lens ~/Downloads/_*
/Users/rmills/Downloads/_IGP9032.DNG  Exif.PentaxDng.LensType                      Byte        3  Sigma 55-200mm F4-5.6 DC
/Users/rmills/Downloads/_IGP9032.DNG  Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 ...
/Users/rmills/Downloads/_IGP9033.PEF  Exif.Pentax.LensType                         Byte        3  Sigma 55-200mm F4-5.6 DC
/Users/rmills/Downloads/_IGP9033.PEF  Exif.Pentax.LensInfo                         Undefined  69  131 0 0 255 0 40 148 ...
/Users/rmills/Downloads/_IGP9034.JPG  Exif.Pentax.LensType                         Byte        3  Sigma 55-200mm F4-5.6 DC
/Users/rmills/Downloads/_IGP9034.JPG  Exif.Pentax.LensInfo                         Undefined  69  131 0 0 255 0 40 148 ...
1240 rmills@rmillsmbp:~/gnu/exiv2/0.25 $ 
I think I'll take the rest of the week off!

#33 Updated by Robin Mills almost 2 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 80 to 100
  • Estimated time changed from 12.00 to 15.00

As I haven't heard from Simon, I'm going to assume this is resolved. If nothing further is reported on this matter, I'll close this issue at the end of December.

#34 Updated by Simon Harhues almost 2 years ago

Sorry for the late reply. It took me a while to set up a virtual machine and build & install trunk. I now accomplished it and tested a couple of files from the Pentax ist*DL and Pentax K10 successfully.
I might be able to get hold of another Pentax body to test the lens around Christmas, but not earlier.
For the use with darktable, I'll just wait until it is bundled with a new release of exiv2.
Thanks for your support Robin!

#35 Updated by Robin Mills almost 2 years ago

You're welcome, Simon. I suspect there will be more activity on this issue. When you find something, please update this issue, or report a new issue.

I didn't write Exiv2, however I know the code is robust and reliable. Like all software, it has a back-log. The aim of v0.26 is to clear that back-log, and that's how I came to look at your 3-year old issue. I hope to get our slate clean and keep it that way. We'll see.

Let's hope #816 is history! Thank You for working with me on this.

#36 Updated by Simon Harhues almost 2 years ago

Robin, as promised I just tested the lens with a Pentax K-3 (all at 55mm). It seems there is still some work needed:

simon@vmubuntu1510:/tmp/fotos/101_2012$ exiv2 -pt IMGP2220.DNG | grep Lens
Exif.PentaxDng.LensType                      Byte        4  Sigma Lens
Exif.PentaxDng.LensInfo                      Undefined 128  0 131 128 0 0 255 1 184 0 0 0 0 0 0 0 0 40 148 71 78 128 70 244 65 89 136 88 61 1 64 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@vmubuntu1510:/tmp/fotos/101_2012$ exiv2 -pt IMGP222 | grep Lens
IMGP2220.DNG  IMGP2221.JPG  IMGP2221.PEF  
simon@vmubuntu1510:/tmp/fotos/101_2012$ exiv2 -pt IMGP2221.PEF | grep Lens
Exif.PentaxDng.LensType                      Byte        4  Sigma Lens
Exif.PentaxDng.LensInfo                      Undefined 128  0 131 128 0 0 255 1 184 0 0 0 0 0 0 0 0 40 148 71 78 128 70 244 65 89 136 88 61 1 64 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@vmubuntu1510:/tmp/fotos/101_2012$ exiv2 -pt IMGP2221.JPG | grep Lens
Exif.PentaxDng.LensType                      Byte        4  Sigma Lens
Exif.PentaxDng.LensInfo                      Undefined 128  0 131 128 0 0 255 1 184 0 0 0 0 0 0 0 0 40 148 71 78 128 70 244 65 89 136 88 61 1 64 107 251 255 255 255 0 0 128 70 244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
simon@vmubuntu1510:/tmp/fotos/101_2012$

The raw files are too big, but you can download all three at: https://www.dropbox.com/sh/93rw7vigr65etxa/AAA6A8wJVHvjg6mDKevjk3Wca?dl=0
As usual, feel free to use the images for the further development of exiv2.

#37 Updated by Robin Mills almost 2 years ago

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

Thanks Simon. This is just the news I wanted for Christmas! Gives me something to do on Friday, I guess. I've submitted a fix: r4135

I've forgotten exactly what this is about, however I had something similar today with a Canon Camera and Lens. #1140. I see you now have 128 bytes in PentaxDng.LensInfo and LensType now has 4 bytes. Quickly extracting from the three "kinds" of files:

$ exiv2 -pa --grep lens/i --grep model/i ~/Downloads/*.PEF ~/Downloads/*.DNG
/Users/rmills/Downloads/IMGP4432.PEF  Exif.Image.Model              Ascii      20  PENTAX *ist DL     
/Users/rmills/Downloads/IMGP4432.PEF  Exif.Pentax.ModelID           Long        1  *ist DL
/Users/rmills/Downloads/IMGP4432.PEF  Exif.Pentax.LensType          Byte        2  Sigma 55-200mm F4-5.6 DC                <---   2 bytes
/Users/rmills/Downloads/IMGP4432.PEF  Exif.Pentax.LensInfo          Undefined  36  3 255 0 0 40 148 71 152 80 6 241 65 ... <---  36 bytes
/Users/rmills/Downloads/_IGP9032.DNG  Exif.Image.Model              Ascii      20  PENTAX K10D        
/Users/rmills/Downloads/_IGP9032.DNG  Exif.Image.UniqueCameraModel  Ascii      12  PENTAX K10D
/Users/rmills/Downloads/_IGP9032.DNG  Exif.PentaxDng.ModelID        Long        1  K10D
/Users/rmills/Downloads/_IGP9032.DNG  Exif.PentaxDng.LensType       Byte        3  Sigma 55-200mm F4-5.6 DC                <---   3 bytes
/Users/rmills/Downloads/_IGP9032.DNG  Exif.PentaxDng.LensInfo       Undefined  69  131 0 0 255 0 40 148 68  ...            <---  69 bytes
/Users/rmills/Downloads/IMGP2220.DNG  Exif.Image.Model              Ascii      20  PENTAX K-3         
/Users/rmills/Downloads/IMGP2220.DNG  Exif.Image.UniqueCameraModel  Ascii      11  PENTAX K-3
/Users/rmills/Downloads/IMGP2220.DNG  Exif.PentaxDng.ModelID        Long        1  K-3
/Users/rmills/Downloads/IMGP2220.DNG  Exif.PentaxDng.LensType       Byte        4  Sigma Lens                              <---   4 bytes
/Users/rmills/Downloads/IMGP2220.DNG  Exif.PentaxDng.LensInfo       Undefined 128  0 131 128 0 0 255 1 184 0 0 ...         <--- 128 bytes
$ 
So, the "PENTAX *ist DL", "Pentax K10D" and "PENTAX K-3", write 36, 69 and 128 bytes to PentaxDng.LensInfo (and 2/3/4 bytes into Pentax.LensType).

I've updated pentaxmn.cpp/resolveLensTypeSigma() to respect the 128/4 byte and now I get:

992 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pa --grep Lens ~/Downloads/*.DNG 
/Users/rmills/Downloads/IMGP2220.DNG  Exif.PentaxDng.LensType                      Byte        4  Sigma 55-200mm F4-5.6 DC
/Users/rmills/Downloads/IMGP2220.DNG  Exif.PentaxDng.LensInfo                      Undefined 128  0 131 128 0 0 255 1 184 0 0 ...
/Users/rmills/Downloads/_IGP9032.DNG  Exif.PentaxDng.LensType                      Byte        3  Sigma 55-200mm F4-5.6 DC
/Users/rmills/Downloads/_IGP9032.DNG  Exif.PentaxDng.LensInfo                      Undefined  69  131 0 0 255 0 40 148 68 ... 
$ 
Here's the new code:
if ( value.count() == 2 ) {
    // http://dev.exiv2.org/attachments/download/326/IMGP4432.PEF
    // exiv2 -pv --grep Lens ~/Downloads/IMGP4432.PEF
    NO CHANGE
} else if ( value.count() == 3 ) {
    // http://dev.exiv2.org/attachments/download/858/_IGP9032.DNG
    NO CHANGE
} else if ( value.count() == 4 ) {
    // http://dev.exiv2.org/attachments/download/868/IMGP2220.DNG
    // 0x0207 PentaxDng    LensInfo  Undefined 128    0 131 128   0 0 255   1 184   0 0 0 0 0
    //                                                    0   1   2   3 4   5   6
    if ( lensInfo->count() == 128 && lensInfo->toLong(1) == 131 && lensInfo->toLong(2) == 128 ) index = 8;
}
Thanks for the test data. I've extracted the metadata into test/data/exiv2-bug816e.exv and updated the test suite to inspect him as a regression detector.

Can I ask you to build and run some tests. I've chosen to test the length and bytes 1 and 2 - this could be a wrong guess. If you find files for which this doesn't work, please post them and I will investigate.

#38 Updated by Simon Harhues almost 2 years ago

Hi I can only recommend to add that lens and a couple of different bodies to your wish list to make sure that you're still busy on Saturday as well. ;) But don't worry.
I recompiled and just went through all my photos of the last 14 months and checked them. The Sigma lens now gets always recognized correctly. That's great! I will try to shoot some more with the K3 body to have more test samples and come back to you then.

Note to myself:

find /tmp/fotos/ -name "*.PEF" -o -name "*.DNG" -exec sh -c 'exiv2 -pt {} | grep "Sigma"' \; -print > ~/raws

#39 Updated by Robin Mills almost 2 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 80 to 100
  • Estimated time changed from 15.00 to 17.00

That's great. I'm going to restore this to "Resolved 100%" until you say otherwise.

Here's the bill for my help. I'd like you to visit OpenHub.net and register (it's free). Give the Exiv2 project a great rating (4 or 5) and give me kudos.

Exiv2: https://www.openhub.net/p/exiv2
Clanmills: https://www.openhub.net/p/exiv2/contributors/60065117754297

Happy Holidays. Always good to hear from you.

Robin - Build Master and Developer Support Engineer

#40 Updated by Simon Harhues almost 2 years ago

Robin, I did a couple of new shots with the K3 body and they all get recognized. Great work, thanks! I believe we can keep it closed (until somebody comes around with a new body).
BTW as I was a little afraid that you would get bored on Friday I created the two issues #1141 and #1142. ;)

Happy Holidays and thanks for your great support again!

#41 Updated by Robin Mills almost 2 years ago

I haven't closed the bug. It's marked 100% resolved. If nothing else surfaces, I'll marked it closed before we ship v0.26. Not sure I'll look at the new issues this week. However I will look at them.

I have never noticed that Simon Harhues is an anagram of "Santa Claus". Oh, thank you Santa, now I know you are real!

#42 Updated by Robin Mills over 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux