When you take a photo with almost any digital camera, the camera
embeds useful information about the photo into the JPEG file itself.
This often includes information about exposure time, focus, aperture,
whether the flash was activated, and focal length. The last of these,
focal length, is especially useful when creating panoramas. This page
describes how to extract the focal length from the EXIF tags
of a digital photo and to convert it to pixel units, so that it can be
used in the panorama stitcher.
direct link to Windows executable
Once you have jhead, you can run "jhead foo.jpg" from the command line, which will output something like this:
Sample jhead output:
File name : foo.jpg
File size : 463023 bytes
File date : 2001:08:12 21:02:04
Camera make : Canon
Camera model : Canon PowerShot S100
Date/Time : 2001:08:05 15:39:33
Resolution : 1600 x 1200
Flash used : No
Focal length : 5.4mm (35mm equivalent: 36mm)
CCD Width : 5.23mm
Exposure time: 0.100 s (1/10)
Aperture : f/2.8
Focus Dist. : 1.18m
Metering Mode: center weight
Jpeg process : Baseline
The field you're looking for is focal length. In this case,
the focal length is listed as "5.4mm". We'll need to convert this to
pixels to use this in the panorama stitcher.
Sometimes the CCD width on dpreview is given as a ratio of inches (e.g., 1/2.7""). The conversion from these units to millimeters is not straightforward, but you can look up the mapping here.
If you have trouble finding the sensor size, please contact the TAs.
focal length in pixels = (image width in pixels) * (focal length in mm) / (CCD width in mm)
For the example photo above taken with the Canon PowerShot S100, this would be:
focal length in pixels = 1600 pixels * 5.4mm / 5.27mm = 1639.47 pixels
So the focal length we would use for the stitcher is 1639.47.