Let’s start with the basics (see diagram below). A camera registers the image of an object produced by a lens onto a CCD (or film if you’re going old school). The position of the object (z) and the position of the image (z’) are related to the focal length of the lens as follows:

In photography, lenses have focal lengths are of the order of millimitres, and the objects are usually meters away from the lens. This means we can make the approximation that a is almost infinity and a’ is almost f’. Rewriting the above formula we obtain:

Where f/stop should be interpreted as a single variable,  f is the focal length of the lens (f = -f’), and D is the diameter of the aperture.

Depth of fieldexamples

Introducing our previous formula for depth of focus (highlighted in orange) we obtain THE FORMULA, the reason I wrote this whole post! :)

In order to express this formula in a nicer way let’s use the f/stop number (photographers see this on their lenses all the time), which is defined as:

Depth of fieldphotography examples

Say I now want to shoot a landscape. I will use my Canon 550D again, this time with my 18-55mm lens. I want to go wider angle now so I’ll use my lens at about 18mm and an f/stop of f/10. The mountains I’m trying to shoot are 1km away, for example.

Last, but not least, I would like to acknowledge my university lecturer Prof. Miguel Angel Rebolledo Sanz for fuelling my love of optics in his 3rd year course and providing amazing good lecture notes, which I still look at when I want to refresh my memory (like I did to write this post). Also, I have the best mom in the world (Prof. Pilar Arroyo), who also happens to be a physicist (very super awesomely smart) and is helping me a lot with the physics behind this blog, proofing my equations and programs, as well as providing insightful feedback :)

Let’s perform a simple calculation to find out the size of this circle. If you do not like maths feel free to skip ahead to the highlighted orange formulas, they are the most important (I won’t tell anyone hehe).

“So what does all this have to do with depth of field” you might ask. Well, let’s start by defining two very important terms, which are often confused:

And vice versa: the DOF of a photograph decreases with decreasing f/stop (i.e. increasing aperture diameter), decreasing CCD pixel size, decreasing distance of the object, and increasing focal length of the lens.

MX7, based on our revolutionary ZST+ platform, premium probe technology and advanced algorithm, is designed to provide trustworthy imaging for clinicians, rendering more confidence on diagnosis.

Let’s crunch in some numbers, shall we? Before we get into it I want to make an important remark: We have made several approximations in the derivation of the expression for the depth of field. This means that the number we obtain from our calculations will only be reasonable if all the approximations are valid. So take these results with a grain of salt, looking more at their order of magnitude (tiny/small/big/huge) than at their exact value.

In photography we are more interested in the depth of field (DoField). It is related to the depth of focus by the magnification of the lens:

Image

Objects that are in the object plane and focus on the CCD will turn up as small points. And objects that are out of focus will turn up as larger circles on the CCD, which will increase in size as the element moves further away from the object plane (see diagram below).

Depth of field equationpdf

Where the squiggly lines indicate that we have made an approximation (that the depth of field is much smaller than the position of the imaging plane), and Beta is the magnification of the lens:

Deepdepth of field

DEPTH OF FOCUS: is the range through with the image plane (the CCD or film) can be moved backward and forward with respect to the camera lens and the object still be in satisfactory sharp focus.

What I’m getting from this is if you want a shallower depth of field it’s hard to justify squeezing the last drops of a smaller fstop because of the squared on the distance to subject factor. For example from a 50mm f1.8, going to an f1.2 would not only be quite expansive but also only reduce by 0.6 as getting just 10cm closer would reduce by a factor 4. Quite the difference.

This depth of field is ginormous! So my whole photograph will be in focus :) Here is an example of a photograph taken with these settings:

MX7 facilitates accurate diagnoses based on the leading-edge ZST+ platform while supporting efficient workflow with total customizable touch screen. Ultra-light main unit and super-long 8h battery time empower usage at any mobile clinical environment. Advanced functions and analysis tools can be incorporated into your daily routine.

Hence the displacement of the image by an object out of focus is the diameter of the circle on the CCD times the lens f/stop:

Depth of field equationcalculator

Let’s say I’m going to use my Canon 550 D, where the CCD pixel size is 4.3 microns (list of Canon cameras pixel sizes here). I’ll chuck on my 50mm f/1.8 lens and want to shoot a portrait of my friend Kim, who is standing about 5 metres away from me. Portraits look nice with shallow depth of field to isolate the subject from the background so I will use my lens at f/1.8.

Thank you for going into the details and actually discussing the scientific part of the physics behind it. I have looked up many articles and youtube videos but nobody addressed the fundamentals such as pixels, depth of field, and many other parameters and their mutual relationships. overall a great article that will cater to both science nerds and photographers alike.

Depth of fieldphotography

As you can see below, the yellow and green triangles are the same triangle but in different sizes. We can use this fact to compare their bases and heights like this:

Wow awesome post!!! There’s much misinformation online about what determines depth of field. I got very curious about it since my own experience doesn’t match a lot of what people say. A big common misunderstanding is that reducing or increasing the focal length and f/ number by the same factor will not change the depth of field since the changes “cancel out”, but that’s not true because depth of field is inversely related to the square of focal length and only linearly related to the f/ number. This means that using focal length extenders or reducers indeed changes the depth of field even though they don’t change the physical aperture size. They multipy DoField by 1/magnification when the subject distance is constant and the f/ number changes by the same factor as the magnification. Also, an image from a 50mm f/1.4 lens has twice the depth of field than that of an image from a 100mm f2.8 lens when the pixel size and the subject distance are constant, so having a longer focal length even with the same physical aperture size helps with obtaining a shallower depth of field. (If I’m understanding those formulas correctly) I wonder when the assumptions used in the formulas for approximation wouldn’t hold up? For example, in the last example you gave, the DoField is approximately 200+km, but the subject is only 1000m away, which means the DoField extends into the imaging plane and doesn’t make too much sense, as we know when a subject is too close to the camera it will become very blurry. Or, for example, if a subject is close to the lens, then the depth of field behind and in front of the subject might differ to a noticeable degree. Will we get a much more complicated formula if we want to account for these situations?

In conclusion, the depth of field of a photograph depends on several factors, which we can use to our advantage when out shooting. It also plays a major role in the creation of images with nice bokeh (check out my “Bokehliciousness” blog post).

Shallowdepth of field

This dept of field is super small! So I’ll have to be really careful with the focus to make sure the subject is not blurry :) Here is an example of a photograph taken with these settings:

Based on these definitions and our diagrams, the depth of focus (DoFocus) will be all the z’ points for which the circle size (d) is equal to or less than the pixel size (dpixel):

Anything left of the lens is considered the object space and the variables are designated by letters like a, z or f (without apostrophe). Anything right of the lens is considered the image space and variables are designated by letters with apostrophes like a’, z’ or f’.

The 2 comes from the fact that elements can be on both side of the object plane, both closer or further away from the camera than where you’re focusing.

Image

When the circle on the CCD is smaller than the pixel size of your CCD (or the grain size of your film) then the camera doesn’t care if the image is a tiny dot or a small circle. This means that all elements that result in a circle size (d) smaller than the pixel size (dpixel) will be seen in focus by the CCD.

That is a really good question Osvaldas :) From what I understand about hyperfocal distance it means that when focusing at this distance, the furthest edge of your depth of field will be at infinity, hence you are maximising the region that will be in focus. It is hard to explain in a short comment, but I’ll add it to the list of potential topics for future posts! Thanks for reading :)

In this post I will explain the relationship between aperture and depth of field of a lens. I hope that the diagrams and examples will make it easy to understand for everyone :)

[…] many a post in which the main theme is a physics concept. Like when I calculated a formula for the “Depth of Field” of a photograph, wrote about “Gravity” and “Lunar Eclipse & Moon […]

Depth of field equationexample

Image

How can objects at different distances be in focus at the same time in your camera? Why does the lens aperture size determine the depth of field of your photograph? Does it depend on anything else? Click through to learn about the physics behind it.

Where D is the diameter of the lens aperture, a’ is the distance between the lens and the image plane, d1 is the diameter of the circle formed from the out of focus object, and DeltaZ1′ is the distance between the imaging plane (CCD) and the position of the object’s image (as seen in the figure below).

Thank you for making this. I’m an engineer and I’m trying to connect the dots between my current knowledge and this new photography hobby of mine. This fits the bill perfectly.

It easily follows from this that objects which are at different distances from the lens will have their images formed at different distances too.