Thursday, August 25, 2016

Photoshop Tutorial: Selecting Foliage & Hair, Extracting Background, and Other Mission Impossible

Some days ago, someone asked "Is there an easy way to remove the background around hair?"
I promised that reader I'd write an article about it, so here it is. Today, we'll see some Photoshop tricks on how to make some very fine selections. In other words, how to use the selection tools and filters available to select hair, fur, foliage, and other difficult items. Usually the purpose of such actions is to extract (or substitute) a background, but in some cases there might be some other reasons too, like applying a filter on a person's hair, etc.

Let's be upfront about this:
There is no easy, fast, one-fits-all solution.
In other words, different images will require different approaches. Some images will be easier than others. More importantly: very often, the quality of the selection will be directly proportional to the amount of work you're willing to put. If you only have 5 minutes to spare, don't expect miracles. If, conversely, you have the patience to work on an image "until it's good", I can offer you some ideas and choices that can make the difference between 1 hour of work and 5 hours of work. Remember that a digital image, when opened on Photoshop, is nothing but a collection of pixels - lots and lots of pixels. Theoretically (strictly theoretically!) you are able to reconstruct it from scratch, painting it pixel by pixel. Practically, nobody can or should do that. The whole point is to make our job easier with Photoshop, not harder.


So, with these in mind, let's begin!



As a first thing, we need to lay down some Theory and Methodology. In other words, we need to understand a couple of things about how Photoshop works and what an RGB image consists of. This will be crucial, as - like I mentioned - I can't offer you a one-fits-all solution. You must understand how it works, so that you can apply it on your own images.

In case you didn't know that already, RGB indicates the three primary channels: RED, GREEN, BLUE. When you open an image on Photoshop and you click on the "channels" tab, you see three black & white displays of your image. When these are combined together, color information is provided.

The trick is, we can make selections based on the individual channels that will then be maintained for the entire image.

You might ask at this point, how does that help us? It's easier to see this with an example. Let's use the image below and suppose we want to select the trees.



 Here are the three individual channels.



 If you are perceptive and have a basic understanding of selection procedures, you begin to see how making selections based on channels actually helps us. The key in making our life easier is to increase the contrast between the area we need to select and the surrounding/background. It goes without saying that using the blue channel above will provide the best alternative.

So, let me say this once more:
In order to make the selection process as easy as possible, you must get the maximum contrast to work with.
  1. Click on the channels tab (usually it's next to the layers tab)
  2. Examine each channel, and choose the one with the maximum contrast between the area you want to select the its background
  3. Use the appropriate selection tool (e.g. magic wand, or magnetic lasso)
  4. On the channel list, click on the RGB to go back to the full-color image. The selection awaits you there.
In the case above it's relatively easy to find the right channel to work with. But what if the difference is more subtle, or what if the background and the subject don't give much to work with in any channel?

Then you can increase the contrast non-destructively. Here's how:

Option A (particularly if there is a slight preference for a channel)
  1. On the channels tab, click on the channel you want to pick.
  2. Drag and drop it onto the "create new channel" icon, on the bottom. You now have a copy of the given channel. 
  3. Using curves or layers (from the Image>Adjustment menu), adjust the contrast of this copy.
  4. Make the selection
  5. Click on RGB, return to the original image. There is no change in contrast.

Option B (particularly if there is no real benefit in choosing a channel)
  1. Create a new Hue/Saturation adjustment layer. Reduce saturation to zero
  2. Create a new curves (or levels) adjustment layer. Adjust contrast to maximize the difference. 
  3. Make the selection (on the topmost adjustment layer, that is curves/levels)
  4. Delete both adjustment layers. You're back on the original image, with no change in contrast or saturation, but with the selection ready.

Of course, I must once again stress the fact: The more time you are willing to dedicate doing micro-adjustments (for instance, zooming in and using the lasso tool to pick a particularly petite detail) the better the final result. There are no magic solutions, only things that can make your life easier.



No comments:

Post a Comment