Sunday, 10 July 2011

Macro Photography using Focus Stacking

Remember : Click the images to see a larger version


Hi all,


In this part of the blog I'm talking about Macro Photography using Focus Stacking. 


So what is Focus Stacking?
Focus Stacking is a technique whereby a series of images is taken of a particular subject. After each image is taken the focus point of the lens is altered very slightly, usually towards the rear of the subject, until a designated amount of shots have been taken. The images are then taken into a suitable software, aligned and then blended together to make one image which is in focus between the first image and the last image.


Why use Focus stacking ? 
Good question! In macro photography the lens is usually set at a very large aperture. Quite often the largest aperture that is available to the lens say f2.8. This allows the maximum amount of light into the lens and onto the sensor but in turn it reduces the Depth-of-Field to an absolute minimum. On some dedicated macro lenses the Depth-of-Field can be reduced down to a few millimetres which is fine if that's the intention of the shot. However if you're thinking of taking a macro shot of something longer than a few millimetres then the resulting image might be a little disappointing as the subject drops into blur after a few millimetres.  Focus Stacking can change all that giving a macro shot with a sharp focus along the entire length of the subject. 


There are several things you need for a good Focus Stack series,


1). A VERY stable set-up, so a good, sturdy tripod is an essential. 
2). A good light source that doesn't vary between each image in the stack series.
3). A camera with a macro lens.
4). A camera that can be set to manual exposure so the exposure doesn't vary between images.
5). Software that handles Focus stacking, (there a loads available)
6). This is a luxury !! A camera that can be controlled by a computer so that the computer can handle incrementing the lens between each shot.


For this demonstration I thought I'd use a subject that most folk would recognise, a USB memory stick. This simply means that the majority of people reading this blog will know just how big the USB stick is and therefore there's no real need to worry about explaining the scale.

The stick in question is a Sandisk Cruzer. I used my Nikon D300s set in manual mode with my Sigma 50mm macro lens set at it's maximum aperture of f2.8. It was sitting on a Manfrotto tripod and I used my LED Macro ring light for illumination. To control the camera I used NK Remote software. 

I took 14 images to make the final image. The 1st image (shown below) is the 1st image in the series and has the connection prongs of the USB stick fully in focus but pretty much everything else is a blur. 


1st image in a 14 image sequence
The 2nd image shown below is actually the 14th image in the series. As you can see in this image everything is a blur except the very last part of the USB stick. The 12 images in between each has a slightly different focus point. 


Last image in a 14 image sequence
Once the series was completed and loaded on to the computer I used Adobe Photoshop CS5 to process them. The first thing to do is to load each of the images in to it's own layer within the same document. To do this in Photoshop I opened Photoshop and then launched Mini-Bridge. From the fly-out menu in Mini-Bridge I highlighted the desired images in the sequence and then selected the command  Photoshop>Load files into Photoshop Layers.  


Images in alignment


This picture shows the 14 images loaded into Photoshop as separate layers. The next stage of the operation is to Align each layer so that all of the layers are in register with each other. This has to be done to ensure that there is no ghosting. To do this stage highlight all of the layers by clicking the top layer then holding shift and clicking the bottom layer. Now go to Edit and select Auto-Align Layers. From the available options choose Auto. Press OK and let Photoshop go to work. On my PC with this amount of layer it took about 1 minute but this will vary with image size and PC speed. 


Once the layers are aligned we need to blend them into one image. So with the layers still selected go to Edit then select Auto-Blend Layers. From the Projection screen select Auto and check the Stacked Images checkbox. Press OK and allow Photoshop to do its stuff. During the process Photoshop evaluates each of the layers and decides what's in focus and what's not. It then creates a series of layer masks to mask out the parts that are out of focus as shown below. 

Blended image with layer masks


Layers with masks
To give you a better idea of what the Layers Panel looks like once the masks are generated I've shown it here. It's worth noting at this point that my own PC took about 5 minutes to complete this part of the process. It can take a lot longer depending on how fast your PC is and of course how big the initial images are. It can look like Photoshop has stopped working but give it time. 

After this part of the process I suggest you save the layers with the masks into a Photoshop document (.PSD) file so that you can fetch it back at any time and make any alterations you feel are necessary. 

After I got to this stage I flattened the file to make it smaller. I added a levels adjustment layer to make the background a little whiter. I added a curves adjustment layer for contrast then finally added a 15pixel black stroke around the inside of the image to provide a simple border. The final image is shown below.  Don't be afraid of Focus Stacking. It sounds more complicated than it really is. There are plenty of tutorials on the internet that give very detailed explanations of the various steps just in case you find this blog a little too  wordy.  



Final Image
Sandisk Cruzer in Macro


Next time ....... some interesting panoramic's.....hopefully