Techniques for cutting out hair accurately
I use the Pen Tool for 90% of the situations where I need to cut someone or something from a photo but sometimes it gets tricky, especially when it comes to hair.
Let's take the following image for example:
- Pen Tool - don't even think about it, it would take years to do an accurate cut so you usually do a more bulky cut.
- Magic Wand & Quick Selection Tool - in some cases these can work, especially if you know your way around with Tolerance and Refine Edge
- Blending modes are very useful in some situations also
When confronted with such an image I usually do use one of the tools from above + get something like 10 color samples from the hair, create a new brush that I adjust from photoshop's brush engine and start drawing hair.
From everything I've tried, redrawing hairs gave me the best results so far.
Q: Is there a better way to get an accurate selection when cutting hair? Or, how can I improve what I've got so far?
PS: Just wanted to add that a situation where the background behind the subject is in a single color like in the sample I offered is rare, therefore an answer based entirely on same color selection won't help that much.
Advanced hair extraction tutorial
First off, plugins and simpler methods are available. This is if you want to get higher quality results. It is largely the same as ACEkin's answer except going into details and with visuals.
I'll be using this photo from Photo by Ariana Prestes on Unsplash.com:
Note: I'm going to be doing the body in a separate layer so I'll be ignoring it for most of this tutorial until the final few steps
Select the Channel with the most contrast in the fine outer hairs. I think Green is the best option:
I'm going to duplicate that channel and rename it to Hair Mask. This will be what I work on until otherwise stated.
Important: If your hair is light on a dark background then you need to invert some of this as far as when to Dodge/Burn and when to use Black/White.
Now to start Apply Image. Multiply or Overlay are good options, sometimes you can even Apply Image twice. Here I applied the Hair Mask to itself with the overlay and lowered the opacity in the settings a bit to not lose the really fine hairs:
I actually did Apply Image Overlay a second pass with a lower Opacity pushing the contrast a bit more. This isn't undoing the first one, its doing it a second time:
Then go into Curves (Ctrl/Cmd+M) and adjust the White and Black point sliders.
Setup some Guides so I could periodically show original vs current at 100%. Here's the first look after just doing Apply Image, Apply Image, Curves:
Now you can like ACEkin said use Brush set to Overlay. I prefer starting with Dodge and Burn though. Burn set to Shadow and I used Exposure of 12 then went over the hairs as carefully as possible. The more careful and time you take the better the results will be. This was maybe 3 minutes, not long at all:
Then at this point go ahead and switch to Brush, Black and fill in the inside. If you want you can first do Black set to Overlay and make another pass at the edges. Again, more time you take the better the results:
Alright, now use Dodge on the spaces between the hairs. Brush set to Overlay White is another option, again I prefer Dodge and Burn. I did Dodge Exposure 12 on Highlights.
Then fill the rest with White.
And let's see where we're at in the 100% view:
With your completed mask selected go back to RGB channel and then layers and apply the mask. I did the body with a separate layer as I mentioned earlier so now I've applied that as well.
Then just refine your mask using the Refine Edge command be sure to use Decontaminate Color
Now the background I picked doesn't really match the lighting and picture, but that's alright. Its not about whether the picture looks real, just about the mask. Could almost always take more time, this is by no means perfect, but here it is which is pretty good for the point of teaching the technique:
And our 100% crop this time looking at the original vs the finished:
I didn't really think about the crop area when choosing a background image to drop in. Since its hard to see that particular area, here's with absolutely no changes to my mask, just got rid of that background for a plain white background for the comparison instead:
Not bad for a Mask from a JPG.