the math of bokeh

If you don’t know (yet) what bokeh is, check out the Wikipedia arti­cle. In short, bokeh is the blur (or qual­ity thereof) of out-of-focus regions in a pho­to­graph. This post is not about the per­ceived qual­ity of such blur, but rather of its size. For bokeh, more is usu­ally bet­ter, since it allows to sep­a­rate an object in focus nicely from the blurred back­ground. For the cal­cu­la­tions that fol­low, we will look at the size of the image of point orig­i­nat­ing far behind an object of inter­est in the pic­ture. To make the cal­cu­la­tions eas­ier, that point is assumed to be infi­nitely far away – the dif­fer­ence to points which are finitely but sig­nif­i­cantly far behind the object will be neg­li­gi­ble.

Bokeh lights in San Diego’s Gaslamp Quar­ter, taken with a Sony DSC-R1 at 69.8mm with f/4.8 and focused to the near limit of about 50cm.

Basics

The disks in Fig­ure 1 are essen­tially the images of point sources located a long dis­tance away and are used here to illus­trate the bokeh effect. In a “reg­u­lar” pho­to­graph, each point in the back­ground of the scene is con­volved with the shape of the bokeh disk and super­posed with the disks from all other back­ground points, just like the over­lap­ping disks in Fig­ure 1. The result is a more or less blurred back­ground which nicely iso­lates an in-focus fore­ground. The larger the bokeh disk, the more pro­nounced the blur effect and fore­ground iso­la­tion will be. For lots of great exam­ples, check out flickr’s Bokeh - Smooth & Silky pic­ture pool.

Cal­cu­lat­ing the expected size of bokeh disks – and thus the strength of the bokeh effect – is not at all that hard. The only for­mula from optics that we need is the thin lens for­mula

$$\frac{1}{f} = \frac{1}{a} + \frac{1}{b} \tag{1}$$

where $f$ is the focal length of the lens, $a$ is the object dis­tance, and $b$ is the image dis­tance. The rest is just basic trigonom­e­try. We will assume a thin lens through­out to make our life eas­ier. How­ever, the results then will only hold for $a \gg f$, since oth­er­wise the geom­e­try of the lens becomes rel­e­vant. There­fore, macro pho­tog­ra­phy is not cov­ered by this post.

The above quan­ti­ties and a few more are shown in Fig­ure 2. Here, $\Delta b$ is the dif­fer­ence in image dis­tance between an object at dis­tance $a$ and one at infin­ity, as can be deter­mined using (1) – for the object at infin­ity, $b = f$. Fur­ther­more, $A$ is the (absolute) aper­ture size of the lens, as related to its f-number $N_f$ by $A = f / N_f$, $w$ is the size of the sen­sor, and $d$ is the diam­e­ter of the bokeh disk on the sen­sor.

Fig­ure 2: Basic quan­ti­ties for bokeh cal­cu­la­tions:
$a$ - object dis­tance
$b$ - image (sen­sor) dis­tance
$f$ - focal length
$A$ - lens aper­ture
$w$ -sen­sor size
$d$ - size of bokeh disk

Now from Fig­ure 2 we have (red ray)

$$d = \Delta b \frac{A}{f} = \frac{\Delta b}{N_f}\tag{2}$$

with

$$\Delta b = \frac{f^2}{a-f}\tag{3}$$

which can be obtained from (1) by set­ting $b = f + \Delta b$. Remem­ber that $a \gg f$, so that actu­ally $\Delta b \ll f$, unlike shown in the fig­ure. Com­bin­ing (2) and (3) we get

$$d = A \frac{f}{a-f} \tag{4}$$

which for $a \gg f$ can be sim­pli­fied to

$$d \approx A \frac{f}{a} = \frac{f^2}{a N_f}\tag{5}$$

So, a large aper­ture $A$ (small f-number $N_f$) will pro­duce large bokeh disks, as well as does a large focal length. At a con­stant aper­ture, the bokeh disk is pro­por­tional in size to the focal length; at a con­stant f-number, the bokeh disk sizes increases with the square of focal length. Also, the closer the object is to the lens the more blurry the bokeh will be.

Stop­ping Down

What hap­pens when the aper­ture becomes smaller because the lens is “stopped down?” Fig­ure 3 shows.

Fig­ure 3: Effect of a smaller aper­ture.

Com­par­ing with Fig­ure 2, we can eas­ily see how the bokeh disk becomes smaller because the angle of the out­er­most (red) rays becomes less acute as they pass through the focal point.

For great bokeh, your aper­ture can­not be large enough, i.e. your lens f-number can­not be small enough.

Sen­sor size

If you’ve ever com­pared a photo shot with a full-frame cam­era to one shot with a phone cam­era, you already know the result of this sec­tion. But we’ll cal­cu­late it any­way.

To image the same field of view (same object size for a given dis­tance), the focal length of a cam­era with a smaller sen­sor must also be smaller, as shown in Fig­ure 4.

Fig­ure 4: Illus­tra­tion of the rela­tion­ship between sen­sor size $w$ and focal length $f$.

The field of view $\theta$ is given by

$$ \tan \frac{\theta}{2} = \frac{w}{2 f} \tag{6}$$

and for an equal field of view $\theta$ we have $w \propto f$. Hence, accord­ing to (5), $d \propto w^2$ for an equal f-number. The cor­re­spond­ing ray tra­jec­to­ries are shown in Fig­ure 5.

Fig­ure 5: Ray tra­jec­to­ries for a smaller sen­sor, leav­ing object dis­tance $a$, field of view $\theta$ and f-number $N_f$ con­stant.

How­ever, since the sen­sor is smaller, the image of the bokeh disk takes up a larger part of the whole image, and to be fair we should nor­mal­ize the disk size $d$ by the sen­sor size $w$ in order to give the size of the bokeh disk as frac­tion of the whole image (which is what you will even­tu­ally see when look­ing at the pic­ture). Then,

$$\frac{d}{w} \propto \frac{w}{a N_f} \tag{7}$$

Thus, the bokeh size as frac­tion of the whole image for a full-frame sen­sor will be about eight times as large as that for a 1/3.2″ sen­sor, as can be found in e.g. the iPhone 5, at the same f-number and field of view. More gen­er­ally, the bokeh frac­tion scales inversely with the “crop fac­tor” for the var­i­ous sen­sor sizes, with APS-C hav­ing about 2/3 that of full-frame, Four-Thirds hav­ing about 3/4 that of APS-C, and so on.

If you sim­ply use a lens with some focal length $f$ and f-number $N_f$ on a cam­era with a smaller sen­sor, you will get bokeh disks which are even larger than those on the large sen­sor (mul­ti­plied by the crop fac­tor), but your field of view $\theta’$ becomes smaller, as also shown in Fig­ure 4, and you might not image the object com­pletely.

For great bokeh, your sen­sor can­not be large enough.

Focal Length with Fixed Object Size

When the object is to be imaged at a cer­tain size on the sen­sor, we have to increase the object dis­tance $a$ when we increase the focal length $f$. How does this affect the bokeh?

For an object of extent $h$ from the opti­cal axis, we need a obser­va­tion dis­tance $a$ that depends on the field of view $\theta$ as

$$\tan \frac{\theta}{2} = \frac{h}{a} = \frac{w}{2f}$$

and thus

$$a = \frac{2f h}{w}$$

where we also used (6). Then with (5),

$$d\bigr|_{h = \mathrm{const}} = \frac{f w}{2h N_f} = A \frac{w}{2h} \tag{8}$$

If you have a zoom lens that has a con­stant aper­ture $A$ through­out the focal length range, the bokeh disk size will not change if you adjust the object dis­tance so as to have a con­stant object size in the image. At a fixed f-number, how­ever, the bokeh disk size increases with focal length, though only lin­early instead of qua­drat­i­cally as in (5).

Epi­log

There you have it. For a given field-of-view to be imaged, noth­ing beats a cam­era with a large sen­sor and a lens with a small f-number, both usu­ally not cheap. Whether the bokeh qual­ity is “good” or “bad” is a whole dif­fer­ent story, though.

In prin­ci­ple, sim­i­lar cal­cu­la­tions can be used to deter­mine the depth-of-field which is basi­cally those dis­tances $\Delta a_+$ and $\Delta a_-$ (instead of the infi­nite dis­tance used here) at which the size of the bokeh disk has some defined value such that an imaged point is just per­ceived as sharp. The bokeh disk in this con­text is called cir­cle of con­fu­sion. See also the Wikipedia arti­cle on depth of field or Paul van Walree’s arti­cle on the depth of field [tooth​walker​.org].


last posts in photography:

5 Comments

  • Some time I ago I tried to find an answer to the fol­low­ing ques­tion: Which bokeh is larger, that of a 6x6 medium for­mat cam­era with a stan­dard lens 80mm f/2.8 or that of an APS-C with 50mm f/1.4 given that the object in focus is imaged at the same rel­a­tive size on the sen­sor and the film frame.

    So let’s assume you own these camera/lens com­bi­na­tions (which, coin­ci­den­tally, I do) and take a por­trait of some­one with the same fram­ing on both cam­eras, i.e. you adjust the object dis­tance accord­ingly. Is the bokeh disk size larger on the medium for­mat 80mm/f2.8 or on the APS-C 50mm f/1.4? My guess is the medium for­mat bokeh balls are larger but I’m not sure.

    It seems that you devel­oped the nec­es­sary the­ory to answer that ques­tion. (I will try to do it.)

    Very inter­est­ing post, btw!!!

  • Marcus wrote:

    That’s actu­ally pretty easy using (8) from the post. Assumung 56mm film size for the medium for­mat cam­era and 14.9mm for the APS-C sen­sor (Canon’s APS-C) – I’m using the height, but you could use the width of 22.3mm if you like, depend­ing on if you want to crop ver­ti­cally in the APS cam­era or hor­i­zon­tally in the medium for­mat – you get the fol­low­ing (infin­ity) bokeh disks:

    $$d_\text{medium} = \frac{1}{2h} 1600\text{mm}^2$$

    $$d_\text{APS-C} = \frac{1}{2h} 532\text{mm}^2$$

    So yes, bokeh on the medium for­mat is about three times as large.

  • Assume that you will print both por­traits on the same paper size. I think in this case one should rather look at d/w to make a fair com­par­i­son. If I under­stand (8) cor­rectly, d/w scales with f/Nf for h const. So the APS-C wins since 50/1.4 > 80/2.8 ?

  • Marcus wrote:

    You are cor­rect! Unlike in (7), I for­got the nor­mal­iza­tion in my answer.
    So it seems that huge aper­tures beat huge sensors/films in this case. Now where do I get an f/1.4 lens for the Sony NEX sys­tem?

  • Hey Mar­cus! Die Mailadresse, die ich von Dir habe funk­tion­iert nicht, Meld Dich mal! Achso ja übri­gens Einfallswinkel=Ausfallswinkel! Ich wollte auch was zum Optik Thema beitragen…Zwinker!

Post a Comment

Your email is never shared.