Focus stacking allows you to take a number of images ( taken with differing focus planes ) and stack them into a single image with a deeper depth of view/focus. This is particularly useful for macro photography where the depth of field is generally very small and restrictive. Hugin’s enfuse component has the ability to do this.
The 1st step is focus alignment
- put all your images into a single folder and navigate to that folder
align_image_stack -m -a OUT FILE1 FILE2 FILE3
The 2nd step is the actual stacking
enfuse --exposure-weight=0 --saturation-weight=0 --contrast-weight=1 --hard-mask --output=output.tif input-<0000-9999>.tif
Using the Laplacian Edge Detection method
enfuse --exposure-weight=0 --saturation-weight=0 --contrast-weight=1 --hard-mask --gray-projector=l-star --contrast-edge-scale=0.3 --output=output.tif input-<0000-9999>.tif