Feature #1118

Add support for ZEISS Loxia 2/50 lens

Added by Eugen Neu almost 2 years ago. Updated over 1 year ago.

Status:ClosedStart date:19 Sep 2015
Priority:NormalDue date:
Assignee:Robin Mills% Done:

100%

Category:lensEstimated time:2.00 hours
Target version:0.26

Description

Hi,

I am using a ZEISS Loxia 2/50 lens on a Sony Alpha 7 II (ILCE-7M2) body. The lens seems not to be supported by my currently installed version (0.24 on Ubuntu 15.04) and I could not find an entry in the current source code for it. Find below the necessary information and a sample jpeg. If there is anything else I could try or provide, I would be glad to help.

Kind regards,
Eugen

exiv2 output from raw file:
$ exiv2 -pt DSC00479.ARW |grep -ai lens
Exif.Sony2.LensID Long 1 E-Mount, T-Mount, Other Lens or No Lens
Exif.Photo.LensSpecification Rational 4 500/10 500/10 20/10 20/10
Exif.Photo.LensModel Ascii 10 E 50mm F2

exiv2 output from jpeg file:
exiv2 -pt LRG_DSC00972.JPG| grep -ai lens
Warning: Directory Sony1, entry 0x0000 has unknown Exif (TIFF) type 0; setting type size 1.
Warning: Directory Sony1, entry 0x0000 has unknown Exif (TIFF) type 0; setting type size 1.
Exif.Sony1.LensID Long 1 E-Mount, T-Mount, Other Lens or No Lens
Exif.Photo.LensSpecification Rational 4 500/10 500/10 20/10 20/10
Exif.Photo.LensModel Ascii 10 E 50mm F2

Lens name:
ZEISS Loxia 2/50

Link to product page:
http://www.zeiss.com/camera-lenses/en_de/camera_lenses/loxia/loxia250.html

LRG_DSC00972.JPG (525 KB) Eugen Neu, 19 Sep 2015 07:11

History

#1 Updated by Robin Mills almost 2 years ago

  • Status changed from New to Assigned
  • Assignee set to Robin Mills
  • Target version set to 0.26
  • % Done changed from 0 to 50

Thanks for reporting this and providing the sample JPG. And congrats on your new camera and lens. My neighbour has that camera and says its wonderful.

I'm using the current trunk:

644 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 --verbose --version --grep svn --grep version
exiv2 0.25 001900 (64 bit build)
version=4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)
svn=3947
id=$Id: version.cpp 3931 2015-09-08 13:01:05Z robinwmills $ 
I've run your file with the -pv and -pt options. -pv = print 'vanilla values' -pt = print 'translated'.

'Vanilla values' means we present raw data.

646 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pv --grep Lens http://dev.exiv2.org/attachments/download/834/LRG_DSC00972.JPG 
Warning: Directory Sony1, entry 0x0000 has unknown Exif (TIFF) type 0; setting type size 1.
Warning: Directory Sony1, entry 0x0000 has unknown Exif (TIFF) type 0; setting type size 1.
0xb027 Sony1        LensID                      Long        1  65535
0xa432 Photo        LensSpecification           Rational    4  500/10 500/10 20/10 20/10
0xa434 Photo        LensModel                   Ascii      10  E 50mm F2
647 rmills@rmillsmbp:~/gnu/exiv2/trunk $ 
'Translated' means we pass values through a presentation filter to make them more human readable.
645 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pt --grep Lens http://dev.exiv2.org/attachments/download/834/LRG_DSC00972.JPG 
Warning: Directory Sony1, entry 0x0000 has unknown Exif (TIFF) type 0; setting type size 1.
Warning: Directory Sony1, entry 0x0000 has unknown Exif (TIFF) type 0; setting type size 1.
Exif.Sony1.LensID                            Long        1  Manual lens
Exif.Photo.LensSpecification                 Rational    4  500/10 500/10 20/10 20/10
Exif.Photo.LensModel                         Ascii      10  E 50mm F2
So it seems:

Exif.Sony1.LensID = 65535 = "Manual lens"
Long 65535 == SShort -1, it's a kind of "don't know, or not a Sony Lens"

Exif.Photo.LensModel is an Ascii string of 10 bytes that your camera wrote.
Perhaps E = ZEISS

Exif.Photo.LensSpecification Rational 4 500/10 500/10 20/10 20/10
Exif uses rational to represent a floating point number. 500/10 = 50.0, 20/10 = 2.0
This is an array of 4 Rationals which record min/max Fnumbers and Focal length for the lens . The code in tags.cpp says:

TagInfo(0xa432, "LensSpecification", N_("Lens Specification"),
                N_("This tag notes minimum focal length, maximum focal length, " 
                "minimum F number in the minimum focal length, and minimum F number " 
                "in the maximum focal length, which are specification information " 
                "for the lens that was used in photography. When the minimum F " 
                "number is unknown, the notation is 0/0"),
                exifId, otherTags, unsignedRational, 4, printValue),
Our wonderful contributor Niels has been looking after our MakerNote support for several years and has recently started a college course in addition to his full-time demanding job. I will take on support for MakerNotes, however this is my first case in this part of the code. I don't really think I can take further action on this.

Perhaps Niels or Andreas will step into this and provide a solution.

#2 Updated by Robin Mills almost 2 years ago

  • % Done changed from 50 to 100
  • Estimated time set to 2.00

I've downloaded the latest version of Phil's wonderful exiftool (v10.02) and here's the output:

512 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiftool -all LRG_DSC00972.JPG | grep -e Lens -e F
File Name                       : LRG_DSC00972.JPG
File Size                       : 525 kB
File Modification Date/Time     : 2015:09:19 10:48:47+01:00
File Access Date/Time           : 2015:09:19 10:56:50+01:00
File Inode Change Date/Time     : 2015:09:19 10:48:47+01:00
File Permissions                : rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
F Number                        : 4.0
Flash                           : Off, Did not fire
Focal Length                    : 50.0 mm
Flashpix Version                : 0100
Interoperability Index          : R98 - DCF basic file (sRGB)
File Source                     : Digital Camera
Focal Length In 35mm Format     : 50 mm
Lens Info                       : 50mm f/2
Lens Model                      : E 50mm F2
MPF Version                     : 0100
MP Image Flags                  : Representative image
MP Image Format                 : JPEG
Scale Factor To 35 mm Equivalent: 1.0
Field Of View                   : 39.6 deg
Focal Length                    : 50.0 mm (35 mm equivalent: 50.0 mm)
513 rmills@rmillsmbp:~/gnu/exiv2/trunk $ 
As you can see, exiftool also reports E 50mm F2.

#3 Updated by Eugen Neu almost 2 years ago

Dear Robin,

first of all thank you for the very fast reply and for your work! I'm not sure if I understand your last update correctly. Does this mean that everything is fine, no additional steps are necessary and the lens will just report as "E 50mm F2" in the future? Or did you add something to the code and it will be released with 0.26?

I looked up exiftool and the lens name and found the following:

6553.37 = Zeiss Loxia 50mm F2
http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Sony.html

However, I am new to the combination of digital photography and open source software. Therefore I am still in the "learning phase" and try to understand how all the different tools (exiv2, exiftool, darktable) are interconnected and how this is related to MakerNote (file format?) and what has to happen to make everything work together. Sorry, if the answer to my question is pretty obvious.

Kind regards,
Eugen

#4 Updated by Robin Mills almost 2 years ago

Well, what I was trying to say is "exiftool and exiv2" are reporting the same information and therefore I do not intend further action.

$ exiftool -ver
10.02
$ exiftool LRG_DSC00972.JPG | grep -i Lens
Lens Info                       : 50mm f/2
Lens Model                      : E 50mm F2
$ exiv2 -pt -g Lens LRG_DSC00972.JPG 2>/dev/null
Exif.Sony1.LensID                            Long        1  Manual lens
Exif.Photo.LensSpecification                 Rational    4  500/10 500/10 20/10 20/10
Exif.Photo.LensModel                         Ascii      10  E 50mm F2
$ 
Your discovery on this page http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Sony.html of:
6553.37    = Zeiss Loxia 50mm F2
The page does say: "Special logic is employed to identify the attached lens when a Metabones Canon EF adapter is used."

Do you have output from exiftool which reports a Zeiss lens, or do you also get "Lens Model : E 50mm F2" ?

Although I've been contributing to Exiv2 for 7 years, this is my first dive into this part of the code. So we're learning together!

Exiv2, darktable and exiftool

Exiv2 is a command-line application exiv2 and a library libexiv2. The code is written in portable C++.
darktable use libexiv2 as a shared library. darktable and exiv2 will normally report the same metadata.
exiftool is a command-line utility and Perl library. The underlying implementation technology is quite different. Generally, exiftool leads the metadata community. It's very good when you have perl on the system.

exiv2 and exiftool are not competitors. http://dev.exiv2.org/projects/exiv2/wiki/How_does_Exiv2_compare_to_Exiftool

MakerNote
The MakerNote is a single Exif tag (0x927c) into which the manufacturer can store anything he wishes in a format of his choosing. http://www.exiv2.org/makernote.html

For you:

$ exiv2 -pt -g Maker LRG_DSC00972.JPG 2>/dev/null
Exif.Photo.MakerNote                         Undefined 37228  (Binary value suppressed)
Exif.MakerNote.Offset                        Long        1  922
Exif.MakerNote.ByteOrder                     Ascii       3  II
$
You have 37k bytes of stuff. libexiv2 (and exiftool) know how to decode most of that data and report it as Exif.Sony1 tags:
$ exiv2 -pt -g Sony LRG_DSC00972.JPG 2>/dev/null
Exif.Sony1.Contrast                          SLong       1  0
Exif.Sony1.Saturation                        SLong       1  0
Exif.Sony1.AutoHDR                           Long        1  Off
Exif.Sony1.ShotInfo                          Undefined 390  (Binary value suppressed)
Exif.Sony1.ColorReproduction                 Ascii      16  Standard
Exif.Sony1.ColorTemperature                  Long        1  0
Exif.Sony1.ColorCompensationFilter           Long        1  0
Exif.Sony1.SceneMode                         Long        1  Standard
Exif.Sony1.ZoneMatching                      Long        1  ISO Setting Used
Exif.Sony1.DynamicRangeOptimizer             Long        1  Auto
Exif.Sony1.ImageStabilization                Long        1  On
Exif.Sony1.ColorMode                         Long        1  Standard
Exif.Sony1.FullImageSize                     Long        2  4000 x 6000
Exif.Sony1.PreviewImageSize                  Long        2  1080 x 1616
Exif.Sony1.FileFormat                        Byte        4  (3 3 1 0)
Exif.Sony1.Quality                           Long        1  Standard
Exif.Sony1.FlashExposureComp                 SRational   1  0 EV
Exif.Sony1.WhiteBalanceFineTune              Long        1  0
Exif.Sony1.WhiteBalance                      Long        1  Auto
Exif.Sony1.SonyModelID                       Short       1  (340)
Exif.Sony1.LensID                            Long        1  Manual lens
Exif.Sony1.ExposureMode                      Short       1  Aperture priority
Exif.Sony1.JPEGQuality                       Short       1  n/a
Exif.Sony1.FlashLevel                        SShort      1  Normal
Exif.Sony1.ReleaseMode                       Short       1  Burst
Exif.Sony1.SequenceNumber                    Short       1  (1)
Exif.Sony1.AntiBlur                          Short       1  On (Shooting)
Exif.Sony1.DynamicRangeOptimizer             Short       1  Standard
Exif.Sony1.IntelligentAuto                   Short       1  Off
Exif.Sony1.WhiteBalance2                     Short       1  Auto
542 rmills@rmillsmbp:~/gnu/exiv2/trunk $ 

#5 Updated by Eugen Neu almost 2 years ago

Robin,

thank you once again for your detailed description. I really appreciate that.

Do you have output from exiftool which reports a Zeiss lens, or do you also get "Lens Model : E 50mm F2" ?

No, I get exactly the same exiftool output as you do.

"Special logic is employed to identify the attached lens when a Metabones Canon EF adapter is used."

I think this comment only concerns lenses that are adapted to the camera using a Metabones adapter. However, the Loxia is a native E-Mount lens.

Actually, I am perfectly fine with the camera reporting as "E 50mm F2". The reason why I thought this would be a problem in the first place was because I loaded a raw file into darktable and when I changed to the "lens correction" module, the lens was reported as

E 50mm F2
camera/lens not found - please select manually

I looked it up and came to this page
https://www.darktable.org/2015/02/on-lens-detection-and-correction/
where it says at some point that one should fill a feature request here.

I found one additional interesting point when I compared the output from the raw file with the output of the jpg file. There seem to be some additional "Lens Type" fields which are not present in the jpg file. exiv2 does not report them. Unfortunately, the raw files are larger than the file size limit. Hence, I can't attach one.

$ ./exiftool -ver
10.02
$ ./exiftool -all DSC00479.ARW|grep -i Lens
Lens Type                       : E-Mount, T-Mount, Other Lens or no lens
Lens Spec                       : E 50mm F2
Lens Zoom Position              : 0%
Lens Mount 2                    : E-mount
Lens Type 3                     : Unknown (49232)
Lens E-mount Version            : 1.50
Lens Firmware Version           : Ver.02
Lens Mount                      : E-mount
Lens Format                     : Full-frame
Lens Type 2                     : Unknown (49232)
Lens Spec Features              : E
Lens Info                       : 50mm f/2
Lens Model                      : E 50mm F2
Lens ID                         : E 50mm F2
$ exiv2 -V
exiv2 0.24 001800 (64 bit build)
$ exiv2 -pt -g Lens DSC00479.ARW
Exif.Sony2.LensID                            Long        1  E-Mount, T-Mount, Other Lens or No Lens
Exif.Photo.LensSpecification                 Rational    4  500/10 500/10 20/10 20/10
Exif.Photo.LensModel                         Ascii      10  E 50mm F2

I am not sure how to proceed from here. Do you thing it would be helpful to know what some commercial tools or the Sony Image Data Converter reports? I don't have installed them but I could try to find out. Or should we leave it that way for the moment and I contact the darktable-user mailing list and try to find out why the camera/lens is not detected properly?

Kind regards
Eugen

#6 Updated by Robin Mills almost 2 years ago

Eugen:

Can I ask the obvious question "What's bothering you, buddy?". Do you want darktable to recognise your equipment precisely?

There are a couple of interesting fields in the exiftool "Raw" file output:

Lens Type 2                     : Unknown (49232)
Lens Spec Features              : E
Can you send me the raw file, please? There's a file-size limit in Redmine. I think it's 20mb. If it's bigger than that, can you share it on Dropbox (or anyother file-sharing service). As a last resort, email it to me:

You could try Adobe's DNG (free) convertor to convert raw files into "Digital Negative". I believe DNG is a kind catch all "Grand Unified File Format for Raw Digital Images". And try that in darktable.

I don't have any suggestions about how to proceed with marketable. I occasionally have dealings with the darktable engineers, however I've never really used the application. I've never heard of Sony Image Data Convertor.

#7 Updated by Eugen Neu almost 2 years ago

Robin,

this made me laugh. :) Good question. I just wanted to try the lens correction function in darktable, did notice that the camera/lens combo was not supported, one thing came after the other and now I am here. I will check Adobe DNG. Sony's Image Data Convertor is the raw processor the camera comes with. I will try a few things over the next days and will send an update when I have gathered enough infos. In the mean time find bellow the link to a raw file:

https://spideroak.com/share/NZSXK/sample/home/neu/Pictures/share/DSC00479.ARW

Kind regards,
Eugen

#8 Updated by Robin Mills almost 2 years ago

Thanks for the file. On Wednesday I had a look on the darktable web site and I see they dumped me (exiv2) with the responsibility for their metadata support. I'd do the same if I were working on darktable. Metadata is a minor part of darktable and they are wrapping our code in their GUI.

We've had a discussion, both on the darktable forum and ours, about providing a file for camera/accessory updates. This would let you "tweak" our recognition. So you could define 65535 to be your lens. And new cameras/accessories could be added between releases of Exiv2. We'd like to do this project, however we don't have a volunteer and I'm fully loaded for v0.26.

I dumped your file with the -pS option in v0.25 (-pS = print Structure). I asked for the file to run this command. There's nothing interesting hidden in the file.

$ exiv2 -pS https://spideroak.com/share/NZSXK/sample/home/neu/Pictures/share/DSC00479.ARW
STRUCTURE OF TIFF FILE (II): https://spideroak.com/share/NZSXK/sample/home/neu/Pictures/share/DSC00479.ARW
 address |    tag                           |      type |    count |   offset | value
      10 | 0x00fe NewSubfileType            |      LONG |        1 |        1 | 1
      22 | 0x0103 Compression               |     SHORT |        1 |        6 | 6
      34 | 0x010e ImageDescription          |     ASCII |       32 |      230 |                                
      46 | 0x010f Make                      |     ASCII |        5 |      262 | SONY
      58 | 0x0110 Model                     |     ASCII |        9 |      268 | ILCE-7M2
      70 | 0x0112 Orientation               |     SHORT |        1 |        8 | 8
      82 | 0x011a XResolution               |  RATIONAL |        1 |      278 | 278/0
      94 | 0x011b YResolution               |  RATIONAL |        1 |      286 | 286/0
     106 | 0x0128 ResolutionUnit            |     SHORT |        1 |        2 | 2
     118 | 0x0131 Software                  |     ASCII |       15 |      294 | ILCE-7M2 v1.21
     130 | 0x0132 DateTime                  |     ASCII |       20 |      310 | 2015:09:14 14:46:54
     142 | 0x014a SubIFDs                   |      LONG |        1 |   147600 | 147600
     154 | 0x0201 JPEGInterchangeFormat     |      LONG |        1 |   148642 | 148642
     166 | 0x0202 JPEGInterchangeFormatLeng |      LONG |        1 |  1114012 | 1114012
     178 | 0x0213 YCbCrPositioning          |     SHORT |        1 |        2 | 2
     190 | 0x8769 ExifTag                   |      LONG |        1 |      436 | 436
     202 | 0xc4a5 PrintImageMatching        | UNDEFINED |      106 |      330 |  ...
     214 | 0xc634 DNGPrivateData            |      BYTE |        4 |    53658 | ...r
   38428 | 0x00fe NewSubfileType            |      LONG |        1 |        1 | 1
   38440 | 0x0103 Compression               |     SHORT |        1 |        6 | 6
   38452 | 0x010e ImageDescription          |     ASCII |       32 |    38600 |                                
   38464 | 0x010f Make                      |     ASCII |        5 |    38632 | SONY
   38476 | 0x0110 Model                     |     ASCII |        9 |    38638 | ILCE-7M2
   38488 | 0x0112 Orientation               |     SHORT |        1 |        8 | 8
   38500 | 0x011a XResolution               |  RATIONAL |        1 |    38648 | 38648/0
   38512 | 0x011b YResolution               |  RATIONAL |        1 |    38656 | 38656/0
   38524 | 0x0128 ResolutionUnit            |     SHORT |        1 |        2 | 2
   38536 | 0x0131 Software                  |     ASCII |       15 |    38664 | ILCE-7M2 v1.21
   38548 | 0x0132 DateTime                  |     ASCII |       20 |    38680 | 2015:09:14 14:46:54
   38560 | 0x0201 JPEGInterchangeFormat     |      LONG |        1 |    38700 | 38700
   38572 | 0x0202 JPEGInterchangeFormatLeng |      LONG |        1 |    13365 | 13365
   38584 | 0x0213 YCbCrPositioning          |     SHORT |        1 |        2 | 2
$ 
You will of course notice that Exiv2 can read files using https. Good, eh? RemoteIO (http, https, ftp, sftp, ssh) is an optional feature of Exiv2 that was added in v0.25. By default, it's not available (although http is always available). To build webready support, build Exiv2 as follows:
$ make config
$ ./configure --enable-webready
$ make -j
$ sudo make install
This requires libcurl, openssl and libssh which you should download, build and install.

#9 Updated by Robin Mills almost 2 years ago

I like your photo. Pyracantha and ivy I believe. I was cutting my neighbour's pyracantha last weekend. Damn thing suddenly moved and ripped my finger. I needed 4 stitches at the emergency room.

#10 Updated by Robin Mills almost 2 years ago

  • Status changed from Assigned to Resolved

I'm going to mark this "Resolved" which means that I do not intend to do any more work on this. Of course, if you provide further information it will be investigated. This issue will be closed during review before shipping v0.26.

#11 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