The ExifTool LensType lists contain the long names of the lenses
including whether it's a fisheye or not. F.e.
> http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html#LensType
> http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#LensID
> http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Pentax.html#LensType
> http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Minolta.html#LensType
and more...
--
Erik Krause
http://www.erik-krause.de
thanks for effort. Basically I see this as the foundation for a
feature that would be very, very welcome: Automatic loading of lens
profiles, either as hugin's ini files or even using lensfun...
I haven't had a chance to compile a development version but those are
the results using exiv2:
Tokina ATX 3,5-4,5/10-17 on a Canon cam:
Exif.CanonCs.LensType Short 1 Canon EF
20-35mm f/3.5-4.5 USM
Exif.CanonCs.Lens Short 3 10.0 - 17.0 mm
Sigma 8mm f/3.5 on a Canon as well:
Exif.CanonCs.LensType Short 1 Sigma 8mm
f/3.5 EX DG Circular Fisheye
Exif.CanonCs.Lens Short 3 8.0 mm
Projection is circular fisheye for both (as the Tokina is shaved and
on a fullframe). I guess an "i" line says it all:
Tokina 10-17mm:
i w2920 h4386 f2 v117.772439775232 Ra0 Rb0 Rc0 Rd0 Re0 Eev0 Er1 Eb1
r-0.26688363778535 p6.42867375867582 y8.88850974602797 TrX0 TrY0 TrZ0
j0 a-0.076564228939927 b0.146416251483121 c-0.127273572255958
d3.29060949385297 e32.5427777981069 g0 t0 Va1 Vb-0.18283780242918
Vc0.141516026005642 Vd-1.72893502580412 Vx0 Vy0 S-571,3497,192,4260
Vm5 u10 n"fused_img_7119_ca.tif"
Sigma 8mm:
i w2920 h4386 f2 v188.893386867747 Ra-0.0238978080451488
Rb-0.00565842119976878 Rc0.0556895099580288 Rd0.0127557357773185
Re0.0257034469395876 Eev12.9657842161378 Er1 Eb1 r88.2204948922683
p-0.766704317808744 y7.84659018364293 TrX0 TrY0 TrZ0 j0 a-0.0364017
b-0.0961726510604123 c-0.025814 d4.67388 e29.6742 g0 t0 Va1
Vb-0.279826201600424 Vc-1.52248326430879 Vd-2.2738137786917 Vx0 Vy0
S80,2850,838,3608 Vm5 u10 n"jmg_4601_ca.tif"
Cheers
Felix
These things can be fixed as they seem to be the sort of thing that
lensfun should support. I hoped that this would make a good Summer
of Code project but nobody was interested.
We have a lot to gain from Hugin/lensfun integration: Hugin and
Calibrate Lens are the best tools for adding new camera/lenses to
the lensfun database, using the database to detect lenses will make
Hugin simpler and more reliable, and there is a wider community
around RAW converters that are already commited to using and
maintaining lensfun.
--
Bruno
> So please post the lens names and the projection Hugin should set
> automatic.
Sigma 8.0 mm on a Nikon D80: Circular Fisheye (iPhoto tells a bit more: http://cl.ly/BFCA) in portrait orientation.
Hugin was manually set to Circular Fisheye, the lens.ini is attached below.
Habi
Thomas, I'm manually patching the name of my Samyang fisheye into the
EXIF data, since it's a manual lens and the body knows nothing of it.
When I do that, I can set the Lens Model by assigning
-LensModel="Walimex Pro Fisheye 8mm"
but I cannot find a way of setting the Lens Type. I have the suspicion
that the Lens type is an integral number pertaining only to Canon
Lenses, and whatever string I pass it comes out 0. In exiv2 I get
IMG_3928.tif Exif.CanonCs.LensType Short 1 (0)
IMG_3928.tif Exif.CanonCs.Lens Short 3 9.0 mm
IMG_3928.tif Exif.Canon.LensModel Ascii 24 Walimex Pro
Fisheye 8mm
when I do what you propose:
> The lens name can be read inside Hugin (images tab) or you are using
> exiv2 (run "exiv2 -pt image.jpg | grep Lens" and search for lens name
> in the output, depending on the maker a different tag is shown).
Which tag does your code look up?
In the hugin images tab, I get Lens (0), as if the code was looking at
the Lens Type tag.
> PS: If the lens is not recognized by exiv2 (and therefore by hugin),
> this will not work. In this case it needs to be fixed in exiv2 or the
> lens information is not stored inside the EXIF header, e.g. for some
> manual lenses. This can't be fixed by Hugin.
This is why I patch the lens info with exiftool. I am using this
command:
exiftool -FNumber=8.0 -ApertureValue=8.0 -FocalLength="9.35 mm" -
LensModel="Walimex Pro Fisheye 8mm" -ShortFocal="9.35 mm" -
LongFocal="9.35 mm" -Lens="9.35 mm" -FocusDistanceLower="0.45 mm" -
FocusDistanceUpper="inf" -FocalLengthIn35mmFormat="14.96 mm"
<myimage.CR2>
maybe looking at the Lens Type tag is wrong, and the Lens Model tag,
which actually contains a string, so you can search against it in a
database, is better? Or is this only so with Canon bodies?
And, while I'm at it, I never got an echo on my proposals to autoload
lens.ini files based on the Lens Model EXIF tag. Maybe you didn't look
at my postings concerning the matter, they're in this thread just a
few up from here.
Kay
While we are on the subject of automating lens calibration, it might
be appropriate to think about the shortcomings of the lens model in
libpano, which is unchanged since the 1994 version of PanoTools. 1)
it offers just two model lens curves, rectilinear and equal-angle
spherical; whereas in reality most short focal length lenses, whether
'normal' or 'fisheye', follow some other curve (the existence of the
"Thoby Projection" proves this is a practical issue); 2) the 3-
coefficient polynomial correction, that we rely on to take care of the
differences between the model and actual curves, is ambiguous (many
sets of coefficients can match the same lens) and somewhat unstable
(small changes in control point set can give big changes in the
polynomial); 3) worse, the correction polynomial is specific to the
size and orientation of the image array, so that PT calibrations are
not portable between cameras, or even between different resolution
settings of the same camera, or rotated copies of the same image.
It would not be hard to replace the PT lens model with one that is
free of those defects. That would let us have really useful,
shareable lens databases, and give us the full benefit of work like
Thomas's on automating the identification of lens and camera. It
should be noted that information about sensor dimensions and pixel
array formats remains just as important, but is no longer factored
into the "lens" calibration, so another database of camera
characteristics is an essential part of any solution.
For Panini-Pro, I developed a portable universal lens model, and
supporting lens and camera databases. I've had good experience with it
as a way to manually match my various fish-eye lenses and camera
formats. The lens model has 4 parameters: focal length (as given by
the manufacturer); curve shape, which 'zooms' continuously from
rectilinear through stereographic through equal-angle to equal-area;
and major and minor correction factors, which adjust a 4 term
polynomial, but in a way that does not allow wild deviations from a
realistic model. In addition of course the working lens/camera model
must know the physical and logical (pixel) dimensions of the camera
sensor (to support full camera calibration it also accepts optical
axis offsets and tilts). I haven't yet tried optimizing these
parameters from control points, but I am confident that would be a
stable process, as they simply cannot generate absurd curves.
Would anyone like to work with me on putting this model into libpano13
and setting up Hugin to test it? (Or perhaps calibrate-lens would be a
more suitable test bed). My Hugin build environment (for Windows) is
not up to date and I could use some help updating it. Plus I have
little time to program outside my primary commitment to Panini-Pro.
Merry Christmas and a Happy New Year,
-- Tom
> I cannot find a way of setting the Lens Type. I have the suspicion
> that the Lens type is an integral number pertaining only to Canon
> Lenses, and whatever string I pass it comes out 0. In exiv2 I get
>
> IMG_3928.tif Exif.CanonCs.LensType Short 1 (0)
> IMG_3928.tif Exif.CanonCs.Lens Short 3 9.0 mm
> IMG_3928.tif Exif.Canon.LensModel Ascii 24 Walimex Pro
> Fisheye 8mm
>
> Which tag does your code look up?
> In the hugin images tab, I get Lens (0), as if the code was looking at
> the Lens Type tag.
I dug a bit deeper and found (what I think is) the relevant section in
SrcPanoImage.cpp, line 371 ff.:
Exiv2::ExifData::const_iterator itr2 = Exiv2::lensName(exifData);
if (itr2!=exifData.end())
{
//we are using prettyPrint function to get string of lens name
//it2->toString returns for many cameras only an ID number
setExifLens(itr2->print(&exifData));
}
The code calls a convenience function from libexiv2, which "Provides
easy (high-level) access to some Exif meta data." The function is
defined in libexiv2's easyaccess.hpp:
//! Return the name of the lens used
EXIV2API ExifData::const_iterator lensName(const ExifData& ed);
This sounds just like the ticket and anyone would expect that it
should deliver a useful string, and not the silly (0) it does in the
case of my Canon with a manual lens. I found no easy access function
for the tag I think should be read, and I suppose libexiv2 is to
'blame' for the unexpected result. It may be possible to use a less
easy-access method to access the LensModel tag instead of the LensType
tag, but I haven't looked further than this, and I'm not sure if the
issue is the same with non-Canon bodies. Is there anyone else around
using manual lenses which the camera body has no idea of? What does
show up on your image tab's lens field - or have you never patched in
your lens' parameters, since there was no obvious immediate benefit?
Kay
some details how the lens is saved.
AFAIK the most cameras save the lens in the maker notes. There are
mainly 2 variants:
1) Saving the lens as a (coded) number (e.g. used by Nikon, Olympus)
2) Saving the lens as string (e.g. Panasonic)
For Canon there exists both variants:
* tag LensModel (0x0095): a string
* tag LensType (id depends on camera type): a number (int16s)
I assume that all newer Canon camera are using the LensType tag. The
string variant seems to be an older, now not used tag (Just guessing,
I have no Canon).
Saving the lens name as string would only work for the camera with
store the lens as string (item 2 above).
But I came to another solution:
EXIF specification version 2.3 introduced the tags Lens Specification,
Lens Make, Lens Model and Lens Serial Number.
The tag LensModel is a string and can therefore used for images of all
makers (don't mix this with the tag with same name in the Canon
makernotes).
Maybe some newer camera (compatible with exif version 2.3) do already
write this tag.
I modified the code to read first this new tag, if this is not found
then it should use the lens from the maker notes.
So you can use
exiftool -LensModel=YOUR LENS NAME image
to patch the image file.
Maybe it would be nice to update also Exif version, because the
LensModel is only defined in 2.3 and above (not 2.2), so use
exiftool -LensModel=YOUR LENS NAME -exifversion=0230 image
(For Canon it could be necessary to use -Exif:LensModel for forcing
the exif tag and not update the maker note tag).
> And, while I'm at it, I never got an echo on my proposals to autoload
> lens.ini files based on the Lens Model EXIF tag. Maybe you didn't look
> at my postings concerning the matter, they're in this thread just a
> few up from here.
I did not forget this, but this is postponed after the integration of
the lensfun library.
Thomas
I have also looked into the matter a bit. I have come to the
conclusion that, at least in case of my Canon, LensType is a short
integer and codes for all different types of Canon lenses. Mind you,
Canon lenses. There are no numbers for other Lenses, and the various
exif-processing tools seem to have lists of which Canon lens number
should yield which string. I suppose I could have a Carl Zeiss lens
and there wouldn't be a number for it - let alone my Samyang fisheye.
I can write to the tag (with exiftool I can even write to the raw
file) but nothing will ever make a string from that tag that fits my
lens, unless I've overlooked something silly.
> Saving the lens name as string would only work for the camera with
> store the lens as string (item 2 above).
>
> But I came to another solution:
> EXIF specification version 2.3 introduced the tags Lens Specification,
> Lens Make, Lens Model and Lens Serial Number.
> The tag LensModel is a string and can therefore used for images of all
> makers (don't mix this with the tag with same name in the Canon
> makernotes).
> Maybe some newer camera (compatible with exif version 2.3) do already
> write this tag.
My Canon EOS 450D body does that. It writes the Canon-specific number
to it's Lens Type tag and the corresponding lens name string to the
Lens Model Text. That's where I got the idea to put my lens' name in
there, since the other tag wouldn't let me assign a useful value to
it. After all I was working towards a way to have a tag in the EXIF
data that would allow automatic loading of a lens.ini file, so I had
to find a way. Lens Type wouldn't play, so I took Lens Model. I wasn't
aware this was something new!
> I modified the code to read first this new tag, if this is not found
> then it should use the lens from the maker notes.
Brilliant! This sould make my life a bit simpler - and hopefully not
just mine. After all the Samyang fisheye isn't the only non-Canon lens
around. I'll pull the new code asap. Do you need data for the Samyang
8mm fisheye?
> So you can use
> exiftool -LensModel=YOUR LENS NAME image
> to patch the image file.
The ticket.
> Maybe it would be nice to update also Exif version, because the
> LensModel is only defined in 2.3 and above (not 2.2), so use
> exiftool -LensModel=YOUR LENS NAME -exifversion=0230 image
really? to me this looks as if it might have been around earlier
$ exiftool -exifversion -LensType -LensModel IMG_3929.tif
Exif Version : 0221
Lens Type : Unknown (0)
Lens Model : Walimex Pro Fisheye 8mm
> (For Canon it could be necessary to use -Exif:LensModel for forcing
> the exif tag and not update the maker note tag).
the tag is writable just fine with exiftool, and exiv2 does at least
know how to read it (it can't write CR2)
> > And, while I'm at it, I never got an echo on my proposals to autoload
> > lens.ini files based on the Lens Model EXIF tag. Maybe you didn't look
> > at my postings concerning the matter, they're in this thread just a
> > few up from here.
>
> I did not forget this, but this is postponed after the integration of
> the lensfun library.
I'm glad to hear that. I think recognizing lens types on image load is
a great help, and reading whole lens.ini files could be potentially
even more helpful.
Kay