# HP Forums

You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is my first serious equation for the 17Bii, so I welcome any suggestions for improvement!

First of all, the listing, using the well known formulas(*) for calculating the hyperfocal distance and depth of field:

DOFCALC:TDOF =
0 x L( DM : D x 1000 ) +
0 x L( HFD : FL ^ 2 ÷ ( APERT x COC ) ) +
0 x L( NP : ( ( HFD x G( DM ) ) ÷ ( HFD + ( G( DM ) - FL ) ) ) ÷ 1000 ) +
0 x L( FP : ( ( HFD x G( DM ) ) ÷ ( HFD - ( G( DM ) - FL ) ) ) ÷ 1000 ) +
0 x L( HFD : HFD ÷ 1000 ) +
IF( FP < 0 : 0 : FP - NP )

Where:

TDOF = the total DOF in meters, or 0 when the DoF is infinite.
D = the focus distance in meters. Internally the formulas use mm for distance and focal length.
FL = the focal length in mm.
APERT = the aperture value.
COC = the known CoC value for the medium (sensor or film.). For a digital APS-C sensor, I use CoC = 0.015

When computing the TDOF, you can RCL the NP (nearest point in focus) and FP (farthest point in focus), and the hyperfocal distance (HFD). When the DoF value is 0 (representing infinity), the farthest focus point is meaningless.

Caveat: I have tested this on the RLM tools 17Bii iPhone app, but it should work on the physical 17Bii calculator as well.

(I could have saved some parentheses, but left them in for clarity, because the formulas as explained in Wikipedia use them as well).

(*) there are two slightly different formulas for calculating the hyperfocal distance, but in practice the differences are too small to be meaningful, so I used the shortest one.

[attachment=7900]
Nice post, that equation format is very clear and easy to follow when entering.

A small suggestion is when making a post like this, it's useful to include one (or more) sets of data, with keying instructions, and results for a sample run, which both explains how it's intended to be used, and also lets the reader confirm that he/she has entered the equation properly.

This is good advice for all machines, but especially important for Solver Language, where it can be hard to verify exact entry (as you've probably discovered by now).
(12-08-2019 06:50 PM)jthole Wrote: [ -> ]This is my first serious equation for the 17Bii, so I welcome any suggestions for improvement!

First of all, the listing, using the well known formulas(*) for calculating the hyperfocal distance and depth of field:

DOFCALC:TDOF =
0 x L( DM : D x 1000 ) +
0 x L( HFD : FL ^ 2 ÷ ( APERT x COC ) ) +
0 x L( NP : ( ( HFD x G( DM ) ) ÷ ( HFD + ( G( DM ) - FL ) ) ) ÷ 1000 ) +
0 x L( FP : ( ( HFD x G( DM ) ) ÷ ( HFD - ( G( DM ) - FL ) ) ) ÷ 1000 ) +
0 x L( HFD : HFD ÷ 1000 ) +
IF( FP < 0 : 0 : FP - NP )

Where:

TDOF = the total DOF in meters, or 0 when the DoF is infinite.
D = the focus distance in meters. Internally the formulas use mm for distance and focal length.
FL = the focal length in mm.
APERT = the aperture value.
COC = the known CoC value for the medium (sensor or film.). For a digital APS-C sensor, I use CoC = 0.015

When computing the TDOF, you can RCL the NP (nearest point in focus) and FP (farthest point in focus), and the hyperfocal distance (HFD). When the DoF value is 0 (representing infinity), the farthest focus point is meaningless.

Caveat: I have tested this on the RLM tools 17Bii iPhone app, but it should work on the physical 17Bii calculator as well.

(I could have saved some parentheses, but left them in for clarity, because the formulas as explained in Wikipedia use them as well).

(*) there are two slightly different formulas for calculating the hyperfocal distance, but in practice the differences are too small to be meaningful, so I used the shortest one.

You could also do it this way (a little less verbose):

DOFCALC:TDOF =
0 x L( DM : D x 1000 ) X
L( HFD : FL ^ 2 ÷ ( APERT x COC ) ) X
L( NP : ( ( HFD x G( DM ) ) ÷ ( HFD + ( G( DM ) - FL ) ) ) ÷ 1000 ) X
L( FP : ( ( HFD x G( DM ) ) ÷ ( HFD - ( G( DM ) - FL ) ) ) ÷ 1000 ) X
L( HFD : HFD ÷ 1000 ) +
IF( FP < 0 : 0 : FP - NP )

Beautiful equation.
(12-08-2019 10:37 PM)Don Shepherd Wrote: [ -> ]You could also do it this way (a little less verbose):

DOFCALC:TDOF =
0 x L( DM : D x 1000 ) X
L( HFD : FL ^ 2 ÷ ( APERT x COC ) ) X
L( NP : ( ( HFD x G( DM ) ) ÷ ( HFD + ( G( DM ) - FL ) ) ) ÷ 1000 ) X
L( FP : ( ( HFD x G( DM ) ) ÷ ( HFD - ( G( DM ) - FL ) ) ) ÷ 1000 ) X
L( HFD : HFD ÷ 1000 ) +
IF( FP < 0 : 0 : FP - NP )

Beautiful equation.

Of course! That happens when you only work on an equation on paper, without thinking of optimising it ;-)

BTW; I typed in mine in the actual 17Bii now (not the iPhone app), and it works fine ... just not sure about what is the best order of the variables yet.

For those who do not know what a Depth of Field calculator is; it is a tool used for photography to estimate how much will be in focus in your photo. Because there is a gradual transition from "in focus" to "out of focus", there is a focus area, rather than a focus point. That has to do with resolution of the medium (print, slides, digital display), and viewing distance. The Circle of Confusion basically is (taking a huge shortcut in explaining here) a measure for the maximum image blur that is invisible for the viewer. This Wikipedia article offers a very good explanation: https://en.wikipedia.org/wiki/Circle_of_confusion

Anyway, for the Fujifilm APS-C sensor, I use a value of around 0.010 ~ 0.015. For paper prints, 0.015 is already overkill, due to the low resolution. For digital crops out of an image, the acceptable sharpness is much tighter.

As an example; the Fujifilm X100T camera has a 23mm lens, an APS-C sensor (let's use CoC=0.015), and a working aperture (which defines how much light comes in) range of between f/2.8 and f/11. Again, for more details, Wikipedia is an excellent source.

Last aspect; hyperfocal distance is the subject distance where everything behind the subject seems in focus (is acceptable sharp to the viewer). In this case, the sharpness range runs from HFD/2 to infinity. Focussing farther than the HFD only increases the nearest "in focus" point, but does not have a real effect on the farthest point (infinity plus a bit is still infinity). For practical reasons, I usually focus at easy distances, like 10 meters.

So, to use the equation, I enter the following in my 17Bii:

FL=23mm (the fixed lens focal length of the X100T)
COC=0.015 (or 0.010, if you want to stay on the safe side)
APERT=8 (f/8, which is a good start for light cloud daylight photos outside)
D=10m

And we want to see if this ensures that "everything" will be in focus:

Solving for TDOF gives a value of "0", which in this context means that the DoF is infinite.
RCL HFD gives 4.40833 (which is interesting; I would have been safe with a focus distance of 5 meters, which btw is not marked on the lens scale ... markers are at e.g. 1, 2, 10, and INF distances).
RCL NP gives 3.06446, so everything from 3.1m to infinity will be sharp.

Now with a telelens, let's say with a focal length of 210mm (on a camera with the same sensor, e.g. the X-T1).

Let's go with a subject distance of 10m again (but that may well be below the minimum focus distance of the lens!), and try to make a nice portrait with a blurry background. For that reason, we'll start with an aperture value of f/4:

So now we enter:

FL=210mm (the focal length to which we set our telelens)
COC=0.015 (or 0.010, if you want to stay on the safe side)
APERT=4 (f/4, which should ensure a nice blurriness ... avoiding the "bokeh" word here)
D=10m

And the results weget:

TDOF = 0.26644 (so only 26cm in total will be in focus!)
HFD = 735 (so at f/4, you'd need to focus at an object 735m away to have a fully sharp background!)
NP = 9.87
FP = 10.14

So that means that, if the eyes of our subject are a 10 meters, everything 14cm behind that is out of focus, and everything 13cm in front will be out of focus too. And if we had chosen an even larger aperture, e.g. f/2.8, it might have well been that even the subject's ears would be out of focus! (in fact, everything more than 9.4cm behind the eyes would be, just like everything 9cm in front).

So you see that DoF and hyperfocal distance calculations are very useful for photographers, since they help to estimate what the resulting photo will look like.
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :