Can someone show me the mathematical interpretation of why the image plane is at \$Z=f\$ in the pinhole camera model?

diagram of pinhole image plane and image position math

I found a possibly useful formula in Wikipedia's depth of field article, as quoted below:

Factors affecting depth of field

For cameras that can only focus on one object distance at a time, depth of field is the distance between the nearest and the farthest objects that are in acceptably sharp focus. "Acceptably sharp focus" is defined using a property called the circle of confusion.

The depth of field can be determined by focal length, distance to subject, the acceptable circle of confusion size, and aperture. The approximate depth of field can be given by:

$$\text{DOF}\approx \frac{2u^2Nc}{f^2}$$ for a given maximum acceptable circle of confusion \$c,\$ focal length \$f,\$ f-number \$N,\$ and distance to subject \$u.\$

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.

  • \$\begingroup\$ 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?" \$\endgroup\$
    – Alaska Man
    Commented Jun 15, 2020 at 18:54

3 Answers 3


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.
  • \$\begingroup\$ 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. \$\endgroup\$
    – Alaska Man
    Commented Jun 16, 2020 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:

enter image description here
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.


Very short answer:

There is no lens. The pinhole is literally a hole with a real width and as you get further from it the light from one point in the image spreads to overlap other parts of the image, just like an image going out of focus. So at the pinhole is the most in-focus place there is.

The pinhole is very tiny so the aperture value is enormous so it doesn't matter much and diffraction from the tiny hole tends to dominate.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.