PDA

View Full Version : Lens data in exif


lost
19th of March 2006 (Sun), 20:54
Ok I have been under the impression for a while that the specific lens that was used is not stored in exif, only the focal length. I may have been mislead by someone on this board (ohh my god, say it aint so).

It seems that Photoshop knows at least the range of focal lengths the lens is capable of.

The prosecution submits Exhibit A. (Ok its my only exhibit and probably doesnt need a name but, my thread, my rules. :lol: )

Notice that photoshop CS2 is able to tell that I am using a 24-70mm lens.

Now if we can only figure out a way for EE to use this to more precisely pick the correct lens used.

Ok I have done the easy part Pekka, now get after it. ;)

bfdarren
20th of March 2006 (Mon), 00:41
I think the difference is that Photoshop is looking at the raw data file. I don't think that information is available in the exif fields. At least I could not find anthing about it in the php exif documentation.

Nidz
20th of March 2006 (Mon), 04:12
I think that the only info you will be able to get is the min/max focal length of the lens. I don't believe it has anything stored on the lens to tell the camera what the model is. I think the camera can work out the focal length when you switch it on but that's about all.

MMCM
20th of March 2006 (Mon), 05:50
Depending on the camera used, some of the following information may be available:
Minimum focal length of used lens,
Maximum focal length of used lens
focal length in use
aperture value (= focal length???)
maximum aperture value at current focal length

e. g. a photo shot with my EOS 10D & EF 28-135/3.5-5.6 IS USM in JPEG has following values:
displayed with ACDSee Pro 8:
Exposure time 1/60 s
F-number f/5
Shutter speed value 1/60 s
Aperture value f/5
Max. aperture value f/4 (this is not the max. aperature at minimum focal length, but at the current focal length)
Focal length 44 mm
Maker note (19,00,01,00,03,00,2e,00,00,00,e0,04,00,00,02,00,0 3,00,04,00,00,00,3c,05,00,00,03,00,03,00,04,00,00, 00,44,05,00,00,04,00,03,00,21,00,00,00,4c,05,00,00 ,93,00,03,00,09,00,00,00,8e,05,00,00,06,00,02,00,2 0,00,00,00,a0,05,00,00,07,00,02,00,20,00,00,00,c0, 05,00,00,0c,00,04,00,01,00,00,00,a6,d3,4d,4f,15,00 ,04,00,01,00,00,00,00,00,00,90,08,00,04,00,01,00,0 0,00,c8,cd,12,00,09,00,02,00,20,00,00,00,e0,05,00, 00,10,00,04,00,01,00,00,00,68,01,00,80,0e,00,04,00 ,01,00,00,00,ed,03,22,00,0d,00,01,00,00,02,00,00,0 0,06,00,00,0f,00,03,00,12,00,00,00,00,08,00,00,c0, 00,03,00,0d,00,00,00,24,08,00,00,c1,00,03,00,0d,00 ,00,00,3e,08,00,00,aa,00,03,00,05,00,00,00,58,08,0 0,00,a8,00,03,00,0a,00,00,00,62,08,00,00,a9,00,03, 00,29,00,00,00,76,08,00,00,ae,00,03,00,01,00,00,00 ,f0,0a,00,00,b4,00,03,00,01,00,00,00,01,00,00,00,1 2,00,03,00,18,00,00,00,c8,08,00,00,13,00,03,00,04, 00,00,00,f8,08,00,00,00,00,03,00,05,00,00,00,00,09 ,00,00,00,00,00,00,5c,00,00,00,00,00,03,00,02,00,0 1,00,00,00,00,00,00,00,01,00,00,00,01,00,00,00,00, 00,00,00,00,00,00,00,03,00,02,00,05,20,01,00,ff,7f ,ff,ff,87,00,1c,00,01,00,80,00,30,01,85,00,08,40,0 0,00,00,00,ff,ff,ff,ff,ff,ff,00,00,00,0c,00,0c,00, 00,ff,ff,ff,ff,00,00,00,00,ff,7f,ff,ff,ff,ff,00,00 ,2c,00,92,03,62,02,10,00,16,00,00,00,00,00,42,00,0 0,00,e0,00,0c,00,95,00,bd,00,ec,ff,00,00,03,00,00, 00,08,00,08,00,00,00,ff,ff,00,00,c0,ff,00,00,00,00 ,01,00,f4,01,72,01,94,00,c0,00,5c,00,00,00,00,00,f c,00,00,00,ff,ff,00,00,00,00,00,00,00,00,12,00,00, 00,00,00,00,00,00,00,00,00,ff,ff,ff,ff,ff,ff,49,4d ,47,3a,45,4f,53,20,31,30,44,20,4a,50,45,47,00,00,0 0,00,00,00,00,00,00,00,00,00,00,00,00,00,46,69,72, 6d,77,61,72,65,20,56,65,72,73,69,6f,6e,20,32,2e,30 ,2e,31,00,00,00,00,00,00,00,00,00,00,44,61,6e,75,7 4,61,20,42,75,74,6c,65,72,20,2b,34,33,20,36,39,39, 20,31,31,32,30,20,32,38,34,38,fe,00,00,00,00,00,00 ,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,0 0,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,0 0,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,0 0,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,0 0,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,0 0,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ,0d,00,00,00,14,00,00,00,39,00,00,00,31,02,00,00,0 1,05,00,00,b6,0a,00,00,bd,09,00,00,96,0d,00,00,05, 13,00,00,e0,2b,00,00,16,0b,00,00,3d,4f,00,00,4b,01 ,00,00,e5,01,00,00,8c,06,00,00,f8,45,00,00,b5,ba,0 0,00,01,b2,01,00,1a,a5,01,00,20,70,02,00,f7,b8,03, 00,5e,b4,07,00,2f,cb,01,00,e2,21,0c,00,ee,01,00,00 ,03,03,00,00,5e,0a,00,00,8f,7d,00,00,36,4d,01,00,6 8,f8,02,00,bb,cd,02,00,c1,fb,03,00,32,ba,05,00,ab, 40,0b,00,68,8a,02,00,b5,e9,0f,00,d3,02,00,00,42,04 ,00,00,04,0e,00,00,b9,8c,00,00,44,5f,01,00,66,0c,0 3,00,e9,d7,02,00,e4,09,04,00,26,d6,05,00,73,66,0b, 00,3d,8b,02,00,3d,86,0f,00,fb,01,00,00,eb,02,00,00 ,e0,09,00,00,a6,6d,00,00,d9,17,01,00,a7,6b,02,00,f 4,37,02,00,22,0e,03,00,5f,3a,04,00,bc,d7,07,00,3c, af,01,00,2a,55,09,00,00,00,00,00,00,00,00,00,00,00 ,00,00,00,00,00,00,24,00,01,01,01,02,00,03,00,04,0 2,05,01,06,00,07,00,08,03,09,00,0a,01,0b,00,0c,01, 0d,00,0e,00,0f,01,10,00,11,1a,00,56,01,71,01,74,01 ,aa,00,0d,01,ca,01,ce,01,1e,01,c3,00,fc,01,00,02,a e,01,1a,00,4f,01,6c,01,6d,01,9a,00,fa,00,ac,01,ae, 01,f6,00,b9,00,e4,01,e7,01,84,01,0a,00,4b,03,fd,03 ,03,04,85,02,14,00,a7,12,00,00,00,00,00,00,00,00,0 0,00,00,00,00,00,00,00,52,00,26,06,43,03,3c,03,e3, 03,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,0 0,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,81,00 ,7f,00,81,00,7f,00,07,00,07,00,00,0c,00,08,00,0c,0 0,08,97,00,97,00,f6,03,60,02,00,00,00,00,00,00,a0, fd,0a,fc,00,00,00,00,06,fe,00,00,fa,01,00,00,00,00 ,08,00,ff,ff,00,00,9f,00,07,00,70,00,00,00,00,00,0 0,00,00,00,00,00)

The old Canon File Viewer Utility 1.3.2.11 shows the focal length of the lens used is 28-135 and other tools can show that information too.
If you translate those values to hex you can find them in the Maker notes displayed by ACDsee.
87,00,1c,00

So a lot of information IS available to decide what lens was used.
EE uses only the current focal length used and the min-max focal length entered in the database, and makes A LOT OF WRONG decisions.
If I shoot with my 50/1,4 at 1,4, EE would pick the 28-135, just because it's in the database before the 50/1,4.
I disabled the automatic lens detection alltogether, because it's wrong most of the time!


I'm desperately waiting for EE being able to detect what lens was really used :-(
It would be fine to exclude some lens not used any more from the database search, too.
And a specific search order...

best regards
Martin, Vienna/Austria
http://www.photo-photo.at

Pekka
20th of March 2006 (Mon), 08:25
EE uses only the current focal length used and the min-max focal length entered in the database

Wrong. EE uses focal range if it is available. The key issue here is what is available. If PHP EXIF can not handle makerdata (internal EXIF has no such code yet, apart for some Canon items) then focal range is not read, which means it is not used in lens guess procedure at all.

The lens search engine is sane and works as well as it could work. I have simplified it is EE 2. It can detect if you used Canon 70-200 2.8, but it can not see if it was IS or not, or if it was Sigma. If it has no focal range but only actual focal lenght used available, a 85mm 5.6 shot can be 70-200 2.8 IS, 70-200 2.8, 70-200 4, 85 1.8, 85 1.2L, 28-135 and many more. There is simply no way around it if the data is limited.

Two examples (this data is added to "VIEW COMBINED CAMERA DATA" in EE 2.0) which explain partly how guess system works.

First it checks "MANUFACTURER HIT POINTS FOR IDS" which means lenses which are by same manufacturer thank the camera.
Then "MIN APERTURE HIT POINTS FOR IDS" which means all lenses which can do this aperture.
Then "ACTUAL FOCAL MM HIT POINTS FOR IDS" which means if lens can do this focal lenght.
Then "IF PRIME HIT POINTS FOR IDS" means if a prime is found.
Then "RANGE SEARCH HIT POINTS FOR IDS" if same focal lenght is found in Camera displayname.

Each above is weighted, so e.g. the "RANGE SEARCH HIT POINTS FOR IDS" gives more "hit points" than others. In first example the search gets four lenses with identical hit points.

--------------

AVAILABLE DATA
xmp_focallenght
xmp_lens
exif_focal 160
canon_longfocal
canon_shortfocal
exif_focalrange

Searching maker: Canon | Searching aperture: 4.5 | Searching focal: 160 | Searching focal range: 160

MANUFACTURER HIT POINTS FOR IDS 2 4 15 6 7 9 10 11 12 13 16 17 18
MIN APERTURE HIT POINTS FOR IDS 1 2 3 4 15 5 6 7 8 9 10 14 11 12 13 16 17 18
ACTUAL FOCAL MM HIT POINTS FOR IDS 15 6 9 13 16
IF PRIME HIT POINTS FOR IDS
RANGE SEARCH HIT POINTS FOR IDS

highest ranking lens id found is: 16
Canon 70-200 f/2.8L IS

---------

The second example has more data available so it is more accurate. Still there are 3 lenses which get same points


AVAILABLE DATA
xmp_focallenght 100
xmp_lens 70.0-200.0
exif_focal 100
canon_longfocal
canon_shortfocal
exif_focalrange

Searching maker: Canon | Searching aperture: 3.5 | Searching focal: 100 | Searching focal range: 70-200

MANUFACTURER HIT POINTS FOR IDS 2 4 15 6 7 9 10 11 12 13 16 17 18
MIN APERTURE HIT POINTS FOR IDS 1 2 3 4 5 6 7 8 10 14 11 12 16 17
ACTUAL FOCAL MM HIT POINTS FOR IDS 4 15 6 9 13 16
IF PRIME HIT POINTS FOR IDS
RANGE SEARCH HIT POINTS FOR IDS 6 13 16

highest ranking lens id found is: 16
Canon 70-200 f/2.8L IS

------------



Most secure way to get EE see focal range is to use Photoshop 7 8 or CS. It saves detailed XMP data which EE can see. "Save for web" erases all that data, so use normal JPEG save.

I welcome all help and code you can share to make better exif reading to EE.

In EE 2.0 you can set lens for each photo you upload while uploading. That and various editors which let you set lenses are there to overcome the fact that lens guessing can not work perfectly unless makerdata some day contains real name of the lens "70-200 f/2.8L IS USM".

lost
20th of March 2006 (Mon), 09:17
makerdata some day contains real name of the lens "70-200 f/2.8L IS USM".

Yeah, that would never happen, it would be too simple.

Thanks for the great explination. I will see what I can do to preserver the lens range data in photos.

mvrekum
21st of March 2006 (Tue), 04:14
Interesting thread. I have been searching the internet on this topic and found ExifTool by Phil Harvey (http://www.sno.phy.queensu.ca/~phil/exiftool/).
In the documentation I found the following list of lenstypes for Canon cameras listed in the exif info.


22 LensType int16s
1 = Canon EF 50mm f/1.8
2 = Canon EF 28mm f/2.8
4 = Sigma UC Zoom 35-135mm f/4-5.6
6 = Tokina AF193-2 19-35mm f/3.5-4.5
10 = Canon EF 50mm f/2.5 Macro or Sigma 50mm f/2.8 EX or 28mm f/1.8
11 = Canon EF 35mm f/2
13 = Canon EF 15mm f/2.8
21 = Canon EF 80-200mm f/2.8L
26 = Cosina 100mm f/3.5 Macro AF
28 = Tamron AF Aspherical 28-200mm f/3.8-5.6 or 28-200mm f/3.8-5.6
29 = Canon EF 50mm f/1.8 MkII
32 = Canon EF 24mm f/2.8 or Sigma 15mm f/2.8 EX Fisheye
39 = Canon EF 75-300mm f/4-5.6
40 = Canon EF 28-80mm f/3.5-5.6
43 = Canon EF 28-105mm f/4-5.6
124 = Canon MP-E 65mm f/2.8 1-5x Macro Photo
125 = Canon TS-E 24mm f/3.5L
130 = Canon EF 50mm 5/1.0 USM
131 = Sigma 17-35mm f2.8-4 EX Aspherical HSM
135 = Canon EF 200mm f/1.8L
136 = Canon EF 300mm f/2.8L
137 = Canon EF 85mm f/1.2L
139 = Canon EF 400mm f/2.8L
141 = Canon EF 500mm f/4.5L
149 = Canon EF 100mm f/2
150 = Canon EF 14mm f/2.8L or Sigma 20mm EX f/1.8
151 = Canon EF 200mm f/2.8L
153 = Canon EF 35-350mm f/3.5-5.6L
155 = Canon EF 85mm f/1.8 USM
156 = Canon EF 28-105mm f/3.5-4.5 USM
160 = Canon EF 20-35mm f/3.5-4.5 USM
161 = Canon EF 28-70mm f/2.8L or Sigma 24-70mm EX f/2.8
165 = Canon EF 70-200mm f/2.8 L
166 = Canon EF 70-200mm f/2.8 L + x1.4
167 = Canon EF 70-200mm f/2.8 L + x2
169 = Sigma 15-30mm f/3.5-4.5 EX DG Aspherical
170 = Canon EF 200mm f/2.8L II
173 = Canon EF 180mm Macro f/3.5L or Sigma 180mm EX HSM Macro f/3.5
174 = Canon EF 135mm f/2L
176 = Canon EF 24-85mm f/3.5-4.5 USM
177 = Canon EF 300mm f/4L IS
178 = Canon EF 28-135mm f/3.5-5.6 IS
180 = Canon EF 35mm f/1.4L
182 = Canon EF 100-400mm f/4.5-5.6L IS + x2
183 = Canon EF 100-400mm f/4.5-5.6L IS
186 = Canon EF 70-200mm f/4L
190 = Canon EF 100mm f/2.8 Macro
191 = Canon EF 400mm f/4 DO IS
197 = Canon EF 75-300mm f/4-5.6 IS
198 = Canon EF 50mm f/1.4 USM
202 = Canon EF 28-80 f/3.5-5.6 USM IV
213 = Canon EF 90-300mm f/4.5-5.6
224 = Canon EF 70-200mm f/2.8L IS USM
225 = Canon EF 70-200mm f/2.8L IS USM + x1.4
229 = Canon EF 16-35mm f/2.8L
230 = Canon EF 24-70mm f/2.8L
231 = Canon EF 17-40mm f/4L

Is there anybody who can verify that you simply have to read a number at the above exif address to find the used lens? The exif readers I have don't show the raw data but translate the info on this address immediatly to a focal length.

kheops
21st of March 2006 (Tue), 06:56
doesn't work from my 350d
from a photo with a 70-200 the 23rd field gives me "C8 00" as the long focal, it's 200 so it's correct
the 24th field gives me "46 00", it's 70 so it's correct as well
BUT right before in the file i find "FF FF FF FF" so for me the 22nd which could gave the exact used lens isn't written by the 350d

+

mvrekum
21st of March 2006 (Tue), 08:56
It seems to work for a 1D. I checked an internet file with exif info.

Camera Settings 1 = 64, 2, 0, 4, 0, 0, 0, 0, 0, 4, 0, 1, 0, 32767, 32767, 32767, 32767, 3, 2, 0, 3, 65535, 1, 50, 50, 1, 52, 288, 0, 0, 0, 0

According to the list above this image was taken with a Canon EF 50mm f/1.8 and this confirms with the information from the photographer.