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

Read More


Microsoft Project Lessons

Here are some tips for using MS Project in par­tic­u­lar and project man­age­ment in gen­eral that I picked up, which have either proven use­ful or which sound rea­son­able and which I plan to try out in the future. Feel free to add yours in the com­ments. Leave Buffers Since no project ever goes accord­ing to


Adventures in JavaScript: Number Bases

Here’s just a quick lit­tle JavaScript that will con­vert num­bers between dif­fer­ent bases. It grew out of the idea that num­bers in a sys­tem based on π would be much more use­ful in engi­neer­ing that the reg­u­lar old ones. Well, just because one can do it doesn’t mean it’s a good idea, but it was


Adventures in JavaScript: Humidity

You thor­oughly air out your rooms dur­ing win­ter time and watch the humid­ity inside drop in the process (pro­vided you own a hygrom­e­ter). But where will it stop? This lit­tle gad­get will tell you. Just enter the out­side tem­per­a­ture and humid­ity and the tem­per­a­ture the air will be heated up to inside.   Ref­er­ences [1]


Paraxiality

The pre­vi­ous post on the Gauss­ian beam noted that this beam is a solu­tion to the parax­ial wave equa­tion and thus only accu­rate for small diver­gence angles. The limit given in [1] was $w_0 \gt 2\lambda/\pi$ or $\theta \lt 0.5\mathrm{rad}$ or $\approx 29^\circ$. The Gauss­ian beam model is of course not exact up to that


the Gaussian beam (interactive)

The Gauss­ian beam “is a con­ve­nient, wide­spread model in laser optics.” [1] It is indeed con­ve­nient that such a math­e­mat­i­cally rel­a­tively sim­ple model can describe the evo­lu­tion of laser light in free space so well. Given the wave­length of the laser, it can be described by a sin­gle para­me­ter. This can be either the beam


TiddlyWiki – EditSectionPlugin Keyboard Shortcuts

Like so many of his plu­g­ins, Eric Shulman’s Edit­Sec­tion­Plu­gin for Tid­dly­Wiki is quite awe­some. Espe­cially in long tid­dlers it can save you a lot of scrolling and search­ing. One thing I was miss­ing, though, were the key­board short­cuts ESC to can­cel edit­ing and CTRL+ENTER to fin­ish edit­ing, like the ones you have when edit­ing the


The Coupon (Sticker) Collector

Super­mar­ket chain Edeka cur­rently runs this sticker col­lect­ing racket – which used to be smurf col­lect­ing – where you get four stick­ers with ani­mal pic­tures for every €10 spent. The kids are col­lect­ing like crazy, I am told, even though the pic­tures are mediocre at best. Any­way, as geeks we don’t care much about the


Summer of Code

Dab­bling in JavaScript has been my new past­time for the last few weeks. After a lot of pok­ing in the dark try­ing to cus­tomize my Tid­dly­Wiki, I thought that I could use my new­found JavaScript pow­ers to make more use­ful stuff. So I sat down and wrote a bunch of scripts that add fea­tures to


shopping for a NAS

So I have this inter­nal 500GB HDD drive that holds the backup for my per­sonal data and pho­tos and what­not. Not only is it 98 per­cent full, but also very noisy, even when spin­ning idly. Since some Win­dows process always seems to access it reg­u­larly, it also never spins down. To get some peace of