## Focus stacking steps

**Moderators:** rjlittlefield, ChrisR, Chris S., Pau

### Focus stacking steps

Hello everyone,

I bought the Stackshot and would like some help on how to calculate the steps to set up the Stackshot, for example magnification 3x, aperature F4, etc. How do I calculate the steps that I have to give to the Stackshot in order to do these? For instance, at 3x F/4, you cannot give it a step of for example 0.20.

Also, is it correct that when you change the aperature, you need to change the step sizes? I would appreciate your help as I cannot find any information that can help me with these issues.

I have a Canon EOS 40D and the lens is MP-E 65mm, if this helps.

Thank you in advance for your assistance.

Matthew

I bought the Stackshot and would like some help on how to calculate the steps to set up the Stackshot, for example magnification 3x, aperature F4, etc. How do I calculate the steps that I have to give to the Stackshot in order to do these? For instance, at 3x F/4, you cannot give it a step of for example 0.20.

Also, is it correct that when you change the aperature, you need to change the step sizes? I would appreciate your help as I cannot find any information that can help me with these issues.

I have a Canon EOS 40D and the lens is MP-E 65mm, if this helps.

Thank you in advance for your assistance.

Matthew

- rjlittlefield
- Site Admin
**Posts:**23511**Joined:**Tue Aug 01, 2006 8:34 am**Location:**Richland, Washington State, USA-
**Contact:**

Matthew, for a 40D with MP-E 65, the following are reasonable "get-acquainted" settings:

1X f/11 0.66 mm

2X f/8 0.18 mm

3X f/5.6 0.075 mm

4X f/4 0.037 mm

5X f/4 0.028 mm

These are based on maintaining an "effective f-number" of roughly f/22. This will give you some diffraction blur if you look at actual pixels, but makes a good compromise against stack length.

Yes, you do have to change the step size when you change aperture and when you change magnification.

The required step size can be computed roughly as 2cn(m+1)/(m*m), where c is the "circle of confusion", n is the nominal f-number, and m is the magnification. For many lenses, including the MP-E 65, the effective f-number is roughly n(m+1), that is, nominal f-number multiplied by the quantity, magnification plus one.

The values I've given above are computed using c=0.015 mm, and adjusting n so that n(m+1) is roughly 22 (in the range of 20-24). So, for the second line I chose f/8 because 8(2+1)=24, and the computed step is 2*0.015*8*(2+1)/(2*2) = 0.18 .

Again, these are reasonable "get acquainted" settings. As you acquire more experience, you may want to use larger f-numbers to get shorter stacks at the cost of more diffraction blur, or smaller f-numbers to get sharper images at the cost of shooting more frames. You also may decide to slightly increase or decrease the focus step based on whether you see focus banding with the subjects you're shooting. Random textures can tolerate a larger step, very regular structures like fly eyes may require a smaller one.

Ultimately the best settings are determined by experiment. You want close to the largest f-number that will just barely give the sharpness you need (because of diffraction blurring), and then a focus step that will just barely avoid focus banding for whatever type of subject you're shooting.

I hope this helps. If it's not the right level of information, let me know and I'll try again.

--Rik

PS. This question really should be in Beginners Macro, not Micro, since it's not dealing with microscopes. I'll move it after you've had a chance to respond.

1X f/11 0.66 mm

2X f/8 0.18 mm

3X f/5.6 0.075 mm

4X f/4 0.037 mm

5X f/4 0.028 mm

These are based on maintaining an "effective f-number" of roughly f/22. This will give you some diffraction blur if you look at actual pixels, but makes a good compromise against stack length.

Yes, you do have to change the step size when you change aperture and when you change magnification.

The required step size can be computed roughly as 2cn(m+1)/(m*m), where c is the "circle of confusion", n is the nominal f-number, and m is the magnification. For many lenses, including the MP-E 65, the effective f-number is roughly n(m+1), that is, nominal f-number multiplied by the quantity, magnification plus one.

The values I've given above are computed using c=0.015 mm, and adjusting n so that n(m+1) is roughly 22 (in the range of 20-24). So, for the second line I chose f/8 because 8(2+1)=24, and the computed step is 2*0.015*8*(2+1)/(2*2) = 0.18 .

Again, these are reasonable "get acquainted" settings. As you acquire more experience, you may want to use larger f-numbers to get shorter stacks at the cost of more diffraction blur, or smaller f-numbers to get sharper images at the cost of shooting more frames. You also may decide to slightly increase or decrease the focus step based on whether you see focus banding with the subjects you're shooting. Random textures can tolerate a larger step, very regular structures like fly eyes may require a smaller one.

Ultimately the best settings are determined by experiment. You want close to the largest f-number that will just barely give the sharpness you need (because of diffraction blurring), and then a focus step that will just barely avoid focus banding for whatever type of subject you're shooting.

I hope this helps. If it's not the right level of information, let me know and I'll try again.

--Rik

PS. This question really should be in Beginners Macro, not Micro, since it's not dealing with microscopes. I'll move it after you've had a chance to respond.

- Craig Gerard
**Posts:**2877**Joined:**Sat May 01, 2010 1:51 am**Location:**Australia

Marcio,

As far as I know, we are still waiting on a firmware update for the StackShot from Cognisys which should allow the' high-precision' mode to be accessed directly via the StackShot controller without the need to use additional software. The use of additional software requires a USB enabled controller, so too the ability to update the firmware

There is a workaround that enables the controller to work in increments smaller than 0.20. Some details in the link below:

http://www.photomacrography.net/forum/v ... hp?t=11008

Craig

As far as I know, we are still waiting on a firmware update for the StackShot from Cognisys which should allow the' high-precision' mode to be accessed directly via the StackShot controller without the need to use additional software. The use of additional software requires a USB enabled controller, so too the ability to update the firmware

There is a workaround that enables the controller to work in increments smaller than 0.20. Some details in the link below:

http://www.photomacrography.net/forum/v ... hp?t=11008

Craig

To use a classic quote from 'Antz' - "I almost know

*exactly*what I'm doing!"- Craig Gerard
**Posts:**2877**Joined:**Sat May 01, 2010 1:51 am**Location:**Australia

Marcio, I have trouble with calculations and numbers; but I understand the details of Rik's post. I now have those guidelines stored in my reference material.Marcio wrote:I think You Didn't understand me My Problem is I don't Know how to calculate the steps

When you say "I don't know how to calculate the steps", are you referring to the mathematics or the actual configeration of the StackShot controller. If the latter, set the StackShot controller as follows:

- Mode: Auto-Dist

Dist/step: 0.15mm (adjust this number as per Rik's guidelines)

Select Start Pos, then Select End pos.

http://www.youtube.com/watch?v=_WnE-KI3cng

To persuade the StackShot to move in increments smaller than 0.01 you will need to use the workaround (link below) or Zerene Stacker Professional Edition.

http://www.photomacrography.net/forum/v ... hp?t=11008

Craig

*edit: corrected technical detail

Last edited by Craig Gerard on Tue Sep 13, 2011 11:42 pm, edited 1 time in total.

To use a classic quote from 'Antz' - "I almost know

*exactly*what I'm doing!"- rjlittlefield
- Site Admin
**Posts:**23511**Joined:**Tue Aug 01, 2006 8:34 am**Location:**Richland, Washington State, USA-
**Contact:**

How about this?Marcio21 wrote: My problem is I don't know how to calculate the steps

For the 40D and MP-E 65, you can compute step size as:

step_size = 0.030*n*(m+1)/(m*m)

where:

n = nominal f-number (the f-number set on the camera)

m = magnification (the value set by the ring on the lens)

This will reproduce the numbers that I gave earlier.

The exact step size is not critical. But as you say, "at 3x F/4, you cannot give it a step of for example 0.20". Using the formula, the computed step size would be 0.030*4*(3+1)/(3*3) = 0.053, almost 4 times smaller.

Is this helpful? If not, then can you suggest what sort of answer might be helpful? How about an Excel spreadsheet that implements this calculation?

--Rik

The actual configeration of the StackShotWhen you say "I don't know how to calculate the steps", are you referring to the mathematics or the actual configeration of the StackShot controller

Thank You

Can You Send Me The Spreadsheet Thank YouHow about an Excel spreadsheet that implements this calculation

**I Hope I'm Not Disturbing You All**Thank You Very Much !

If I understood correctly, the 0.015 is my camera sensor size, i.e. Canon 40D. Is this correct? what I didn't understand is why in one calculation, you multiplied everything by 2 in the beginning (2*0.015*8*(2+1)/(2*2) = 0.18 ). I didn't understand from where the '2' came.

I tried doing some calculations from what I could understand. Let me know what you think.

0.015*5.6*(4+1)/(4*4) = 0.026

0.015*5.6*(5+1)/(5*5) = 0.020

Thank You

- rjlittlefield
- Site Admin
**Posts:**23511**Joined:**Tue Aug 01, 2006 8:34 am**Location:**Richland, Washington State, USA-
**Contact:**

It is not your sensor size, but it isMarcio21 wrote:If I understood correctly, the 0.015 is my camera sensor size, i.e. Canon 40D. Is this correct?

*related to*your sensor size. Sensor size in the 40D is physically 22.2 x 14.8 mm, divided out as 3888 x 2592 pixels.

The standard formula for DOF is that

DOF = 2cn(m+1)/(m*m), where c is the "circle of confusion", n is the nominal f-number, and m is the magnification.

This simple formula has its roots in geometric ray tracing. It basically comes from drawing triangles, writing algebra to represent side lengths, and then manipulating the algebra to throw away complicated pieces that are too small to matter for macro applications. You can read about this at http://en.wikipedia.org/wiki/Depth_of_field. (By the way, if you're case-sensitive, notice that the Wikipedia page uses capital N instead of small n to express the f-number.)

The value c -- circle of confusion -- is typically something like 1/1500 of the sensor diameter. My value of 0.015 is about 1/1500 of your sensor

*width*(not its diameter). Using the slighter smaller value just cuts the odds of getting visible focus banding. You can read more about circle of confusion at http://en.wikipedia.org/wiki/Circle_of_confusion. (The Depth_of_field page probably links to it also.)

The 2 comes from the standard formula (so it's rooted in geometry and algebra). In the second formula I gave you, I just did the arithmetic 2 * 0.015 = 0.030, and replaced "2c" with "0.030" to simplify the equation for your particular setup.what I didn't understand is why in one calculation, you multiplied everything by 2 in the beginning (2*0.015*8*(2+1)/(2*2) = 0.18 ). I didn't understand from where the '2' came.

The arithmetic is correct but the result does not mean what you intended it to. Because you left out the 2 but didI tried doing some calculations from what I could understand. Let me know what you think.

0.015*5.6*(4+1)/(4*4) = 0.026

0.015*5.6*(5+1)/(5*5) = 0.020

*not*replace the 0.015 with 0.030, the numbers you compute are only half what the DOF would actually be for your setup. You would get a good looking result, but at the cost of shooting and processing twice the number of images you actually need. Everything else appears to be on the right track, assuming that you're talking about f/5.6 at 4X and 5X.

Again, I'm not sure what sort of answer you're looking for. A StackShot user manual can be downloaded from http://www.cognisys-inc.com/downloads/S ... al_1_4.pdf. In that manual, you want section 3.8, "Mode: Automatic Distance". Enter the step value computed by the formula (rounded to 0.010 mm if your controller requires that). Then press the buttons as described in the manual to establish the start and end positions. The StackShot controller will figure out how many steps are required. You may have to set metric mode first; see section 3.3.10 "Units of Measure".The actual configeration of the StackShot

--Rik

Thank you very much for all you help! Really appreciate it.

So if I am understanding correctly, for a Canon 40D with MP-E 65mm lens and for F/5.6 at 4X, I need to work it out as follows:

0.030*5.6*(4+1)/(4*4) = 0.0525, i.e. 0.053

Is this correct? Also, if I am understanding well, for my setup which is a Canon 40D with MP-E 65mm lens, I have to always use 0.030 to calculate the steps.

Hope I managed to understand this right because I don't want to bother you

Thanks again!!

- rjlittlefield
- Site Admin
**Posts:**23511**Joined:**Tue Aug 01, 2006 8:34 am**Location:**Richland, Washington State, USA-
**Contact:**

- rjlittlefield
- Site Admin
**Posts:**23511**Joined:**Tue Aug 01, 2006 8:34 am**Location:**Richland, Washington State, USA-
**Contact:**