Masking Source Files with the Quick Selection Tool

Article written by Justin Brown

If I could give one piece of advice to someone getting started in HDR, it would be to spend time masking source files.  Today’s HDR software tools keep getting better, but they still aren’t perfect.  There are a few conditions like blinking lights, moving objects, or cloudless blue skies that almost always need masking from source files.  In this article I’ll talk about using the quick selection tool to mask the sky from a source file.

This is the output I got from Photomatix.  The sky has a lot of noise and there is some ghosting in the clouds.  I could probably fix this with the brush tool, but I decided to replace the entire sky with one from a source file to get less noise, and so the result would look more uniform and consistent.

Image Alignment

This is probably obvious, but without perfect image alignment, masking source files will be a disaster.  If you use a tripod you rarely have to worry about image alignment, but sometimes I shoot handheld, and image alignment can be a challenge.  I use Lightroom to organize my photo library, so the first step is to select the HDR file, and all the source files (selecting an image on the left side of the bracket and then holding shift and clicking on the image furthest right will select a consecutive group of images, or holding the control key and clicking one image at a time will add all the clicked images to a selection, holding control and clicking on a selected image will remove that image from the selection).  Once the images are selected I right click and choose Edit In and then Open as Layers in Photoshop…

Auto Align

This will open each image on its own layer in one Photoshop file.  The easiest way to align images in Photoshop is with the auto-align tool.  Select all the layers and go to the Edit menu and choose Auto-Align Layers…

 

Select the Auto radio button and click OK.  The auto process works most of the time, but sometimes the images are still offset.  After the alignment is finished, zoom into the image and uncheck each layer one at a time.  Check for any pixel shifts or other alignment problems.  If everything is aligned then it’s okay to start masking.  If the images still aren’t aligned, then there are some manual options that can be used to improve alignment.

Manual Align

I perform manual alignment with the Move tool (shortcut key: V). Select the top layer, and in the layer blend mode options, choose Difference.  This will show the difference between the top layer and the layers below.  If the two layers are the same, everything will show up as black.  If there are differences they will show up as white or shades of grey.  If the top layer is not aligned with the layer below then white lines appear in areas of high contrast like around windows, or on the horizon.  Here is an example of an image that is offset by a few pixels.

 

To correct the alignment problem use the arrows keys to move the top layer left, right, up or down where it best matches the layer below.

Once the alignment looks good go back to the normal blending mode, and proceed with masking.

Masking with the Quick Selection Tool

HDR software uses a generic algorithm that works in many cases, but the sky very frequently ends up with problems.  Sometimes the clouds get too dark, or the color is non-uniform and unrealistic, other times there are halos or strange bright and dark spots where they shouldn’t be.  To correct this, I sometimes replace the sky with one from a source file.

Make a Selection

I’ve found the quick selection tool to be the quickest and easiest tool for masking a large area like the sky.  I started with the source file on the top layer and the HDR below it, then I created and selected a black layer mask on the source file.  It will work with either file on top, the only difference will be whether it needs a white mask or a black mask.

To start making a selection grab the quick selection tool with a large brush size and quickly click and drag from the left side of the sky to the right making an initial selection.

 

Then zoom in and add or subtract around buildings to get a more accurate selection.  Use the add to selection brush to enlarge the size of the selection, or the subtract from selection to take away.  Holding down the shift key will temporarily switch from add to subtract or vice-versa.  Don’t worry about accuracy around difficult subjects like trees or bushes, but include them in the selection, and in the next section we’ll cover how to deselect the parts we don’t want.

Refine Edge

The refine edge tool helps make the transition along the edge of the selection look natural, and helps refine the selection around fine details.  Click the Refine Edge button on the toolbar above the image.  This will open a new adjustment window.

Make smooth and feather adjustments to make the transition between masked and unmasked areas smoother and more natural looking.  The shift edge adjustment is helpful with skies to avoid creating a halo around buildings.  Use the shift edge tool with a positive % shift to move the selection outward.  This will place the transition within the outline of the building and avoid creating a halo that can occur if the selection does not make it all the way to the edge of the building.

To improve the selection around areas with fine details, go to the Edge Detection section, and move the radius slider to between 3.0 and 5.0px.  This effects how much of the edge of the selection is refined, a higher radius value will make the selection more refined.  Now right click on the icon to the left of Edge Detection that looks like a paint brush and choose Refine Radius Tool.  Go back to the image, and any place with fine details like bushes, tress, or other non-straight edges, start painting with the brush.  The refine edge tool offers 7 different views to visualize the selection.  I like the on white, or black and white options.

 

Continue painting until the selection looks right and accurately accounts for trees and rough edges.  If a problem comes up, you can undo the edge refinement with the Erase Refinements Tool, which is accessible by right clicking on the brush in the Refine Edge window, or also in the toolbar at the top of Photoshop.  Click OK in the refine edge box, and the selection should be shown with marching ants.

In the selected area right click and choose Fill.  Fill with the color White at 100%.  This will expose the top layer where the selection was made, and the bottom layer everywhere else.  Now the image is ready for some finishing touches like sharpening and a few of my favorite filters from Nik Color Efex.

 

In my next article I’m planning to expand on this topic by discussing masking for objects in motion, and some techniques I use to match the source file with the HDR.

My initial journey into the world of photography was a high school black and white film class where I learned to use a camera and to develop and print in the darkroom. However, it wasn’t until years later, and after the purchase of my first DSLR, that I became truly passionate about photography. Based in Southern California I enjoy shooting landscapes and architecture, but I also enjoy traveling and searching for new places to photograph. My focus is HDR photography where I am constantly searching for new processes and techniques to create the best images possible. You can find me on flickr as Justin in SD, or on Google+.
  • ZubbuZ

    Thanks very much for that – some good stuff in there that I didn’t realise could be done :)