Focal Length and Dolly Zoom
In a pinhole camera, the focal length is the distance from the pinhole to the sensor. By similar triangles, an object of height at distance from the pinhole projects to an image of height
upside down on the sensor. A sensor of size (its height, width, or diagonal) sees a field of view (FOV) of angle
A longer focal length gives a narrower view (telephoto), and a shorter one gives a wider view (wide angle).Zooming changes . It scales the entire image by about its center and leaves the relative sizes of near and far objects unchanged. Moving the camera changes every object distance by the same amount, so near objects change size more than far ones, and the perspective changes. A dolly zoom, named after the wheeled cart (dolly) that carries a film camera, moves the camera from distance to from the subject. At the same time it changes the focal length so the subject’s image keeps its size:
The subject stays fixed in the frame while the background grows or shrinks around it. Moving away () needs a longer focal length, which cropping the center of the image can imitate at the cost of resolution. Moving closer needs a wider view than the sensor recorded, which cropping cannot supply. Perspective compression is the flat look of photos taken from far away with a long lens. It comes from the large camera distance. The long lens only enlarges the distant scene to fill the frame.
Intuition
Every formula here comes from one pair of similar triangles. A ray leaves the top of the object, passes through the pinhole, and hits the sensor. The triangle in front of the pinhole has legs and , and the one behind it has legs and . So doubling the distance halves the image, and doubling the focal length doubles it. A zoom multiplies the image size of every object by the same factor. It therefore cannot change how large a near object looks next to a far one. Only moving the camera can do that. A step of one meter is a large fraction of a short distance and a small fraction of a long one.
The dolly zoom uses both effects at once. The camera move changes the background’s size relative to the subject, and the zoom cancels the size change of the subject. The figure shows a subject and a background object before and after the camera moves halfway in and halves its focal length. The subject’s image keeps its height of , while the background’s image shrinks from to .
\usepackage{tikz}
\begin{document}
\definecolor{hot}{HTML}{D9483B}
\definecolor{cold}{HTML}{2F80ED}
\definecolor{mid}{HTML}{8A8A8A}
\begin{tikzpicture}[x=0.8cm,y=1.0cm,>=latex]
\begin{scope}
\draw[mid] (-2.6,0) -- (10.6,0);
\draw[very thick,mid] (-2,-1) -- (-2,1);
\fill (0,0) circle (2pt) node[above] {\small pinhole};
\draw[very thick,cold] (6,0) -- (6,1.5) node[above] {subject $H$};
\draw[very thick,hot] (10,0) -- (10,3) node[above] {background};
\draw[cold] (6,1.5) -- (-2,-0.5);
\draw[hot] (10,3) -- (-2,-0.6);
\draw[line width=2pt,cold] (-2.15,0) -- (-2.15,-0.5);
\draw[line width=2pt,hot] (-2.35,0) -- (-2.35,-0.6);
\draw[<->] (-2,-1.3) -- (0,-1.3) node[midway,below] {$f$};
\draw[<->] (0,-1.3) -- (6,-1.3) node[midway,below] {$d$};
\node[right] at (-2.4,1.5) {\small before};
\end{scope}
\begin{scope}[shift={(0,-5)}]
\draw[mid] (-2.6,0) -- (10.6,0);
\draw[very thick,mid] (2,-1) -- (2,1);
\fill (3,0) circle (2pt) node[above] {\small pinhole};
\draw[very thick,cold] (6,0) -- (6,1.5) node[above] {subject $H$};
\draw[very thick,hot] (10,0) -- (10,3) node[above] {background};
\draw[cold] (6,1.5) -- (2,-0.5);
\draw[hot] (10,3) -- (2,-0.4286);
\draw[line width=2pt,cold] (1.85,0) -- (1.85,-0.5);
\draw[line width=2pt,hot] (1.65,0) -- (1.65,-0.4286);
\draw[<->] (2,-1.3) -- (3,-1.3) node[midway,below] {$f'$};
\draw[<->] (3,-1.3) -- (6,-1.3) node[midway,below] {$d'$};
\node[right] at (-2.4,1.5) {\small after: $d' = \frac{d}{2}$, $f' = \frac{f}{2}$};
\end{scope}
\end{tikzpicture}
\end{document}Properties
(Zoom Is a 2D Scale) Changing alone multiplies every image coordinate by , whatever the depth of the point.
A pinhole camera maps a 3D point to the image point , measured from the image center. Changing to multiplies both coordinates by for every point, near or far. So a zoomed photo equals a scaled-up center crop of the original, apart from resolution. In the language of 2D transformations, a zoom is a uniform scaling about the image center. Two photos taken from the same spot at different zoom settings are related by this scaling, a special case of a homography.
(Moving Changes Size Ratios) Two objects of equal height at distances have an image size ratio of , set only by the camera position.
Walking toward both objects by changes the ratio to , which grows as increases. Walking away makes it approach , so near and far objects look similar in size. That is perspective compression. In a dolly zoom, let the subject be at distance and a background object at distance . The camera move gives the background a new distance . Its image size changes by the factor
Moving in () makes this factor less than , so the background shrinks and seems to rush away. Moving out makes it grow and loom behind the subject.
(Crop Versus Zoom) Cropping imitates a longer focal length but throws away pixels, and it cannot imitate a shorter one.
Keeping the central fraction of each image dimension and resizing it to the full frame matches a focal length of . In a dolly zoom this fraction is . A -pixel-wide photo cropped to half its width keeps pixels across, and the rest of the output pixels come from interpolation. This is the “digital zoom” of phone cameras. The discussion’s crop solution assumes for this reason. A move toward the subject needs a wider view, which would require scene content the sensor never recorded.
(Reading an FOV Number) The field of view depends on the sensor size as well as the focal length, and on which sensor dimension is used.
Putting the sensor width, height, or diagonal into gives the horizontal, vertical, or diagonal FOV. A full-frame sensor is mm, so a mm lens gives a horizontal FOV of . Phone makers quote a “35 mm equivalent” focal length, which is the focal length that would give the same FOV on a full-frame sensor. The same physical focal length on a smaller sensor gives a narrower view.
Examples
(Easy) A Dolly Zoom Shot for Project 0
A camera with a full-frame sensor ( mm wide) frames a friend’s head and shoulders, about m tall, from m with mm. A building stands m behind the friend. The photographer walks in to m.
What focal length keeps the friend the same size? How does the horizontal FOV change? How large does the building look afterward, relative to before? mm. Keeping it requires mm, and indeed mm.
The friend’s image height is
The horizontal FOV goes from to . The formula gives the same without using .
The building’s distance goes from m to m. Its image size changes by . The friend stays the same size while the building shrinks to a third of its size and much more of the street appears around it.
(Medium) Why Selfies Enlarge Noses
A face is photographed with the nose tip at distance from the camera. The ears are about cm farther away. A phone’s main camera has a mm equivalent focal length and a -pixel-wide image.
Compare the nose-to-ear magnification at arm's length ( cm) and at m. What focal length keeps the face the same size at m, and what does cropping cost? Image size scales with , so the nose is magnified relative to the ears by . At cm this is , a enlargement of the nose. At m it is , only . Stepping back fixes the distortion.
Stepping back from cm to cm multiplies the distance by . Keeping the face the same size needs a focal length times longer, mm equivalent. A phone without such a lens can crop instead, keeping the central of the width. That leaves pixels across the cropped frame, which is then enlarged by interpolation and looks soft.