Magic Lantern Forum

Using Magic Lantern => Tutorials and Creative Uses => Topic started by: Ottoga on December 03, 2014, 11:44:38 AM

Title: Focus Stacking - A newbies experience
Post by: Ottoga on December 03, 2014, 11:44:38 AM
I’ve been using ML since it was released for the 7D and the developers have all done a fantastic job in bringing extended functionality to the supported Canon DSLRs. Such an array of functionality that interacts not only with the Canon firmware but also a multitude of individual ML options does, for this black duck anyway, make for an interesting exercise when setting up for a shoot. ML and the contributions from the members here has given me the drive to step way out of my comfort zone.
 Enough of that. I decided to get my head around the focus stacking workflow from set-up through to post processing. After much reading of the forum and viewing of the odd YouTube video I thought that I would give it a go. The following is a sharing of my experience.

The Set-upPost Processing Software:
 Camera set-up
 Nothing clever or sophisticated here.
  For this process to work, the camera absolutely has to be static as does the specific subject that you are focusing on. I’m not sure what the outcome would look like if there was any background movement whilst the sequence was being taken. (Something to try on another day).

The Focus Stack Process

In the ML menu enable follow focus. You need this to drive the lens focusing mechanism whilst setting your start and end points.

( (

Set the focus start and end points of the focus stack. This is a two step process and setting them is a little confusing as you set both via the one parameter. (It would be great if ML was modified to split them into separate parameters). The screen shots below depict examples of the start (0 steps and end points (-8 steps).
If I’m understanding the process correctly, in this example the focus range for the stack will be 8 focus steps behind the start location The actual distance of each step may vary depending on your lens.

( (   ( (

Having set the start and end points, executing the rack focus will drive the lens through the stack range from start to end. Executing it again will drive it from end to start. I found this useful to see if I had set my range correctly.

( (

 Lastly, set the actual parameters that the will be used to run the focus stack. Note that the number of pics taken is automatically calculated.

( (

If the start and end points have been perfectly set you can probably leave the Num of pics and in front and behind set to zero. I chose to add a few additional frames just in case and discarded those not required when post processing.

I wanted as many slices as possible for my focus stacks and as such set the focus steps/picture to 1. If you are using a higher f stop with a greater natural DOF you can increase this and reduce the number of pictures taken.

To capture your stack, just highlight Run focus stack and press set. Sit back and let the magic happen.

 Post Processing
From a post processing perspective all that I was trying to achieve was to merge the stack and produce an image that was in focus from front to back of the subject. Other than a little cropping the outputs are in line with the applications out of the box default settings.

Light Room/Photoshop
Light Room was used to export the images for editing directly into Photoshop as layers. If you know you way around Photoshop you can dispense with Light Room. Then it’s a matter of aligning followed by merging the layers.
One would think that the Align layers and Merge Layers function would be under the Layers menu in Photoshop. They are actually under the Edit Menu (really intuitive – NOT).
Depending on the number of layers and the horsepower of your PC, the above can take some time. At the end you are rewarded with a photo that is in focus across its entire depth. There will be some fuzzy edges that you will want to crop away and there may be some minor out of focus spots in the photo. Manually correcting these when working with layers is beyond my skill level at present.
Pro’s – Handles anything that you can throw at it.
 Con’s – Expensive.
I picked up on this application in an old thread in the ML forum. It is Windows only and can be downloaded via the following link:
If you are running a current version of Windows e.g.: w8.1 you need both the msi and the zip file. It’s functionally very powerful and produced excellent results.
The simple process is to import the files and run a batch job that aligns and merges them ready for outputting in a supported format.
Pro’s – It free, fast, lot’s of user feedback whilst executing various steps and the output was comparable to Photoshop.
Con’s - It’s not a PhotoShop alternative (it’s not meant to be), It’s not very intuitive and I needed to read the available help and experiment a fair bit before I was
            comfortable enough with the functionality that I wanted to use.
           Also it doesn’t support RAW or DNG format files and TIFF output was broken.

I'm sure that there are other products available that will do the job. Someone else might be able to provide some feedback on those.

Example Photos
This example had 10 slices, input were large jpg files. The first image is from Photoshop and the second from CombineZP

( (
( (

The following example had 10 slices and used processed Dual_ISO DNG files in Photoshop. CombineZP didn’t recognise the DNG files so there is no comparison.

 ( (

My final example had 10 slices, input were RAW files in Photoshop. CombineZP didn’t recognise the RAW files so there is no comparison.

( (

Cheers, I hope you found this useful.
Title: Re: Focus Stacking - A newbies experience
Post by: urbanfreestyle on April 09, 2015, 10:24:42 PM
I know it's an old topic but just wanted to say thanks, not something i have tried before but will try it with the help of this guide :)
Title: Re: Focus Stacking - A newbies experience
Post by: fremainjr on August 15, 2015, 06:07:12 PM
Thanks for this tutorial, nice. Help figure out what to do.

quote "The actual distance of each step may vary depending on your lens" is this automatically done?

Title: Re: Focus Stacking - A newbies experience
Post by: Gringuk on January 14, 2020, 11:06:13 AM
Many thanks for this helpful (for a novice) article. It's very well done and easy to understand. Excellent.