# Why is the image plane at Z = f in pinhole camera models?

Can someone show me the mathematical interpretation of why the image plane is at Z = f in the pinhole camera model? I found a possibly useful formula in Wikipedia, as shown in the figure below: My thought is, when the diameter of the aperture approaches zero, the thin lens model becomes the pinhole camera model. And according to the DOF formula, the smaller the diameter of the aperture the larger the f-number, and hence the larger the DOF. In this case, everything appears in focus.

• What is the problem you are trying to solve?, What is the reason you need to know "the mathematical interpretation of why the image plane is at Z = f in the pinhole camera model?" – Alaska Man Jun 15 '20 at 18:54

## 2 Answers

In the "ideal" pinhole camera (pinhole infinitely small), everything is always in focus, because point source of light in the universe outside the camera, the pinhole and the corresponding image point on the film/sensor/back are colinear. In other words there is a single path for light rays between the source and the image, so there is no need for different paths to converge on a single point like you have with a lens.

In you image above the distance between the image plane and the pinhole is arbitrary. The closer the image plane to the pinhole, the smaller the image.

Note that:

• putting the image plane farther from the pinhole makes the image bigger, this is equivalent to using a lens with a longer focal length. In a real-life pinhole camera it also means using a longer exposure since the same amount of light is spread over a bigger area (this is a square law so you can express this with something that looks a lot like a f-number)
• the theoretical pinhole camera has infinite DoF, but it also has an infinite f-number, so be ready for very, very long exposure times.
• It should also be noted that: If you change the distance of the film plain from the pinhole you must also change the size/diameter of the pinhole to the correct size/diameter for that distance. The theoretical pinhole camera infinite DoF is dependent on the correct size/diameter pinhole. – Alaska Man Jun 16 '20 at 18:35

Don't confuse formulas meant to be used with refractive optics (i.e., lenses) with projection mapping functions (such as the pinhole projection model). That is, the Wikipedia formula you found has nothing to do with your question.

The thin lens formula only applies for refractive lenses, such as glass elements that bend light. The thin lens formula is really just an idealization of a refractive element described by the lensmaker's equation with negligible thickness of the lens (hence the name, thin lens). Concepts such as depth of field are defined and derived from applications of the thin lens formula.

The pinhole model is a projection model. That is, it describes the mapping from the field of view to the image plane. The pinhole model is a 1:1 mapping — every ray entering the pinhole leaves the pinhole at the same angle, for the entire field of view. Many refractive lenses (i.e., subject more-or-less to the thin lens model) have a pinhole projection mapping function. But not all. Wide angle lenses, and especially fisheye lenses, do not follow the pinhole projection formula.

This is easy to understand in the degenerate case: how can a circular fisheye lens with a 180° angle of view in all directions project onto the camera's image plane, unless there is some sort of angular distortion such that the further away from the optical axis the subject is, the more the image rays are bent to project within a confined cone? That's impossible to do with a pinhole projection model. But it's not difficult with a series of concave lenses in front of the lens to bend the incoming light into the "funnel" of the lens's collection area and project it onto the camera's image plane.

It appears your first image came from a slide deck PDF (or one of it many copies online) for a senior-level undergraduate class in computer science. Unfortunately, the slide deck could have used one more very simple image to demonstrate the pinhole projection model: Pinhole camera model, from Wikipedia Commons. Public domain.

Here is easy to see the relation between the real-word subject (tree), and its image formation inside the pinhole camera. The depth of the pinhole camera is the focal length, ƒ. The two red rays, the bounding rays of the subject tree, enter the pinhole, and leave (continue towards the image plane) at the same angle. Thus, simple similar-triangle geometry describes the pinhole projection formula.

So, the mathematical reason the image plane is at Z = ƒ is because it is the definition of the pinhole projection model. That is, Z = ƒ is idempotent in the pinhole projection model.