Photography Asked by vivek_jonam on October 5, 2020

I am pretty clear about that DOF depends on:

- Focal length
- Aperture
_{or f-stop} - Distance from subject
- Sensor size

and more (as pointed out in this comment).

But my question is: Is there any formula that relates all these factors with Depth of Field?

Given these values is it possible to accurately calculate the Depth of Field?

Depth of field depends on two factors, magnification and f-number.

Focal length, subject distance, size and circle of confusion (the radius at which blur becomes visible) jointly determine the magnification.

Depth of field does not depend on lens or camera design other than the variables in the formula so there are indeed general formulas to calculate depth of field for all cameras and lenses. I don't have them all committed to memory so I'd only be copying and pasting from Wikipedia: Depth of field.

A better answer to your question would be to go through the derivation of the formulas from first principles, something I've been meaning to do for a while but haven't had time. If anyone wants to volunteer I'll give them an upvote ;)

Correct answer by Matt Grum on October 5, 2020

I don't have the rep to comment...so @KT100 http://graphics.stanford.edu/courses/cs178-09/ explains that the formula is an approximation...it needs very specific numbers to get even close to DoF

Answered by jt peabody on October 5, 2020

P = point focused upon

Pd = distant point sharply defined

Pn = near point sharply defined

D = diameter of circle of confusion

f = f-number

F = focal length

Pn = P ÷ (1+PDf÷F^2)

Pd = P ÷ (1-PDf÷F^2)

Industry standard to set D = 1/1000 of the focal length. For more precise work use 1/1500 of the focal length. Presume 100mm focal length then 1/1000 of 100mm = 0.1mm or 1/1500 = 0.6666mm

Answered by Alan Marcus on October 5, 2020

Here's a simple DOF formula. Hope it helps.

```
DOF = 2 * (Lens_F_number) * (circle_of_confusion) * (subject_distance)^2 / (focal_length)^2
```

Reference: http://graphics.stanford.edu/courses/cs178-09/applets/dof.swf

Answered by KT100 on October 5, 2020

You wanted the math, so here it goes:

You need to know the CoC of your camera, Canon APS-C sized sensors this number is 0.018, for Nikon APS-C 0.019, for full frame sensors and 35mm film the number is 0.029.

The formula is for completeness:

```
CoC (mm) = viewing distance (cm) / desired final-image resolution (lp/mm) for a 25 cm viewing distance / enlargement / 25
```

Anothe way of doing this is the Zeiss formula:

```
c = d/1730
```

Where d is the diagonal size of the sensor, and c is the maximum acceptable CoC. This yields slightly different numbers.

You need to calculate the hyperfocal distance first for your lens and camera (this formula is inaccurate with distances close to the focal length e.g. extreme macro):

```
HyperFocal[mm] = (FocalLength * FocalLength) / (Aperture * CoC)
```

e.g.:

```
50mm lens @ f/1.4 on a full frame: 61576mm (201.7 feet)
50mm lens @ f/2.8 on a full frame: 30788mm (101 feet)
50mm lens @ f/1.4 on a Canon APS frame: 99206mm (325.4 feet)
50mm lens @ f/2.8 on a Canon APS frame: 49600mm (162.7 feet)
```

Next you need to calculate the near point which is the closest distance that will be in focus given the distance between the camera and the subject:

```
NearPoint[mm] = (HyperFocal * distance) / (HyperFocal + (distance – focal))
```

e.g.:

```
50mm lens @ f/1.4 on a full frame with a subject at 1m distance: 0.984m (~16mm in front of target)
50mm lens @ f/1.4 on a full frame with a subject at 3m distance: 2.862m (~137mm in front of target)
50mm lens @ f/2.8 on a full frame with a subject at 1m distance: 0.970m (~30mm in front of target)
50mm lens @ f/2.8 on a full frame with a subject at 3m distance: 2.737m (~263mm in front of target)
50mm lens @ f/1.4 on a Canon APS frame with a subject at 1m distance: 0.990m (~10mm in front of target)
50mm lens @ f/1.4 on a Canon APS frame with a subject at 3m distance: 2.913m (~86mm in front of target)
50mm lens @ f/2.8 on a Canon APS frame with a subject at 1m distance: 0.981m (~19mm in front of target)
50mm lens @ f/2.8 on a Canon APS frame with a subject at 3m distance: 2.831m (~168mm in front of target)
```

Next you need to calculate the far point which is the furthest distance that will be in focus given the distance between the camera and the subject:

```
FarPoint[mm] = (HyperFocal * distance) / (HyperFocal – (distance – focal))
```

e.g.:

```
50mm lens @ f/1.4 on a full frame with a subject at 1m distance: 1.015m (~15mm behind of target)
50mm lens @ f/1.4 on a full frame with a subject at 3m distance: 3.150m (~150mm behind of target)
50mm lens @ f/2.8 on a full frame with a subject at 1m distance: 1.031m (~31mm behind of target)
50mm lens @ f/2.8 on a full frame with a subject at 3m distance: 3.317m (~317mm behind of target)
50mm lens @ f/1.4 on a Canon APS frame with a subject at 1m distance: 1.009m (~9mm behind of target)
50mm lens @ f/1.4 on a Canon APS frame with a subject at 3m distance: 3.091m (~91mm behind of target)
50mm lens @ f/2.8 on a Canon APS frame with a subject at 1m distance: 1.019m (~19mm behind of target)
50mm lens @ f/2.8 on a Canon APS frame with a subject at 3m distance: 3.189m (~189mm behind of target)
```

Now you can calculate the total focal distance:

```
TotalDoF = FarPoint - NearPoint
```

e.g.:

```
50mm lens @ f/1.4 on a full frame with a subject at 1m distance: 31mm
50mm lens @ f/1.4 on a full frame with a subject at 3m distance: 228mm
50mm lens @ f/2.8 on a full frame with a subject at 1m distance: 61mm
50mm lens @ f/2.8 on a full frame with a subject at 3m distance: 580mm
50mm lens @ f/1.4 on a Canon APS frame with a subject at 1m distance: 19mm
50mm lens @ f/1.4 on a Canon APS frame with a subject at 3m distance: 178mm
50mm lens @ f/2.8 on a Canon APS frame with a subject at 1m distance: 38mm
50mm lens @ f/2.8 on a Canon APS frame with a subject at 3m distance: 358mm
```

So the complete formula w/ CoC and HyperFocal precalculated:

```
TotalDoF[mm] = ((HyperFocal * distance) / (HyperFocal – (distance – focal))) -(HyperFocal * distance) / (HyperFocal + (distance – focal))
```

Or simplified:

```
TotalDoF[mm] = (2 * HyperFocal * distance * (distance - focal)) / (( HyperFocal + distance - focal) * (HyperFocal + focal - distance))
```

With CoC precalulated: I've made an attempt to simplify the following equations with the following substitutions: a = viewing distance (cm) b = desired final-image resolution (lp/mm) for a 25 cm viewing distance c = enlargement d = FocalLength e = Aperture f = distance X = CoC

```
TotalDoF = ((((d * d) / (e * X)) * f) / (((d * d) / (e * X)) – (f – d))) - ((((d * d) / (e * X)) * f) / (((d * d) / (e * X)) + (f – d)))
```

Simplified:

```
TotalDoF = (2*X*d^2*f*e(d-f))/((d^2 - X*d*e + X*f*e)*(d^2 + X*d*e - X*f*e))
```

Even further simplified with WolframAlpha:

```
TotalDoF = (2 * d^2 * e * (d - f) * f * X)/(d^4 - e^2 * (d - f)^2 * X^2)
```

Or if nothing is precalculated, you get get this monster, which is unusable:

```
TotalDoF = ((FocalLength * FocalLength) / (Aperture * (viewing distance (cm) / desired final-image resolution (lp/mm) for a 25 cm viewing distance / enlargement / 25)) * distance) / ((FocalLength * FocalLength) / (Aperture * (viewing distance (cm) / desired final-image resolution (lp/mm) for a 25 cm viewing distance / enlargement / 25)) – (distance – focal)) - ((FocalLength * FocalLength) / (Aperture * (viewing distance (cm) / desired final-image resolution (lp/mm) for a 25 cm viewing distance / enlargement / 25)) * distance) / ((FocalLength * FocalLength) / (Aperture * (viewing distance (cm) / desired final-image resolution (lp/mm) for a 25 cm viewing distance / enlargement / 25)) + (distance – focal))
```

Simplified:

```
(50*a*b*c*d^2*f*e*(d-f))/((25*b*c*d^2 - a*d*e + a*f*e)*(25*b*c*d^2 + a*d*e - a*f*e)
```

So basically use recalculated CoC and HyperFocal :)

Answered by psarossy on October 5, 2020

Yes, there are formulas. One can be found at http://www.dofmaster.com/equations.html. These formulas are used on this calculator, it also explains depth of field in more detail. I have used this site several times and have found it to be reasonably accurate after doing practical tests myself.

Answered by damned truths on October 5, 2020

If you want to see a practical implementation of the depth of field formulas you can check out this Online Depth of Field Calculator. The source of the linked HTML page has all the formulas implemented in Javascript.

Answered by Miguel on October 5, 2020

Get help from others!

Recent Questions

- How can I transform graph image into a tikzpicture LaTeX code?
- How Do I Get The Ifruit App Off Of Gta 5 / Grand Theft Auto 5
- Iv’e designed a space elevator using a series of lasers. do you know anybody i could submit the designs too that could manufacture the concept and put it to use
- Need help finding a book. Female OP protagonist, magic
- Why is the WWF pending games (“Your turn”) area replaced w/ a column of “Bonus & Reward”gift boxes?

Recent Answers

- Jon Church on Why fry rice before boiling?
- haakon.io on Why fry rice before boiling?
- Peter Machado on Why fry rice before boiling?
- Lex on Does Google Analytics track 404 page responses as valid page views?
- Joshua Engel on Why fry rice before boiling?

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP