Pinhole Camera

A pinhole maps every scene point along the single straight ray through the hole. The result is an inverted image whose size is fixed by similar triangles — the foundation of perspective projection with blurring convolution.

Magnification  \(m = d_i/d_o\) = 0.50 Image height  \(h_i\) = 0.00 Blur  \(b=a(1{+}m)\) = 0.00 Image is inverted (rotated 180°)

The mathematics

Similar triangles. With the pinhole at the origin, an object of height \(h_o\) at distance \(d_o\) and its image at distance \(d_i\) span two similar right triangles sharing the apex at the hole, so \[ \frac{h_i}{h_o}=\frac{d_i}{d_o}, \qquad h_i = h_o\,\frac{d_i}{d_o}. \] The image lies on the opposite side of the optical axis, hence the minus sign in the signed magnification \(m=-d_i/d_o\). In the diagram the equal right angles (squares) and the equal vertically-opposite angles at the pinhole (arcs) give similarity by AA; matching tick counts mark corresponding edges (1: legs on the axis, 2: vertical legs, 3: hypotenuses).

Perspective projection. Place the camera centre at the origin and the image plane at \(z=d_i\). A scene point \((X,Y,Z)\) projects to \[ \big(x',\,y'\big)=\Big(d_i\,\tfrac{X}{Z},\; d_i\,\tfrac{Y}{Z}\Big), \] which in homogeneous coordinates is the linear map \[ \begin{pmatrix}x'\\ y'\\ 1\end{pmatrix}\;\sim\; \begin{pmatrix} d_i&0&0&0\\ 0&d_i&0&0\\ 0&0&1&0 \end{pmatrix} \begin{pmatrix}X\\ Y\\ Z\\ 1\end{pmatrix}. \] For a real object \((Z>0)\) behind the wall the screen sits at \(z<0\), giving the point reflection \((X,Y)\mapsto -\tfrac{d_i}{Z}(X,Y)\): a rotation by \(180^\circ\) about the optical axis. This is why the pinhole image is upside-down and left–right reversed.

Finite aperture. A real pinhole has diameter \(a>0\), so each object point passes through the whole opening and spreads into a circle of confusion on the image plane. Tracing the rays through the two aperture edges gives a blur disc of diameter \[ b = a\left(1+\frac{d_i}{d_o}\right) = a\,(1+m), \] independent of the point's height — the entire image is uniformly softened by \(b\). Here the image is convolved with that uniform disc (the exact geometric point-spread of a circular aperture), so the softening shown is the true pinhole blur rather than a Gaussian approximation. Geometric optics alone says “smaller \(a\) is sharper,” but diffraction blurs by \(\sim \lambda\,d_i/a\), which grows as \(a\) shrinks. Balancing the two minimises total blur at the classical optimal pinhole diameter \[ a_{\mathrm{opt}} \;\sim\; \sqrt{\lambda\,\frac{d_o d_i}{d_o+d_i}} \;\approx\; 1.9\sqrt{\lambda\, d_i} \quad (d_o \gg d_i), \] which is why a real pinhole has a sweet spot rather than being made infinitesimally small.