6V8 - Production of my Mind

Home page > Photos > Digital Photo Editing: Complex Shape Extraction with Gimp

Digital Photo Editing: Complex Shape Extraction with Gimp

 
Most foreground extraction techniques have problems when it comes to extracting thin or semi transparent objects like hair. In this video tutorial, we’ll see how to create a layer mask to do this extraction in The Gimp.
How to cut out hair, etc. | 21 November 2007, by Mortimer

When you want to extract a person with long hair from the foreground, it’s often very difficult to select the hair as they are very thin and transparent and Everywhereclin d'oeuil. Using the lasso or the magic wand would be just impossible and forget about the path tool! Even the method introduced in Digital Photo Editing: Easy Selection is useless in that case.

What you need is a way to automatically select all this small bits of the picture and have semi transparent selections [1]. This is the technique introduced in this tutorial.

In this video tutorial, I show a full foreground extraction task that gets to this quick montage:

Revenge on Flamborough Head.

The idea is to use the inverted colour of the image to play with the colour contrast and automatically create a grayscale silhouette that can be used as to mask the hair.

You can jump to around 3mins in the video if you want to see only this technique as the video recaps quickly this technique to cut out the rest of the model with a layer mask.

Video Tutorial, Extracting transparent shapes IMG/flv/silvia_extract.flv
This video presents the steps to take to extract thin or semi transparent shape with Gimp.

In this example, we had a very easy almost white background so it’s easier to see the effect. However, this method will also work with a more complex background. You might however have to use it multiple times on smaller parts of the image with different settings for the curve and levels, depending on the colour contrast available.

Here is the different steps to follow:

  1. duplicate the layer you want to cut out,
  2. use the rectangular select tool and select around the specific part you want to work on and limit the layer boundaries to selection (under the layer menu),
  3. We are now going to transform this layer to a mask for the hair. As we want a black and white mask, with the hair in white and the background in black, we start by inverting the colours of the layer [2],
  4. the next step is to augment the black/white contrast to remove the unwanted details of the background. This is done by playing with the curve tool. Draw an S curve [3] and play with the points to get as much details as possible in the hair and remove all the noise in the black,
  5. you should have a blueish/black layer, as we want it to be a black and white mask, desaturate with average values,
  6. there will be some part of the layer that didn’t come out white (like, in our example, the face), just draw in white with the paintbrush over these parts, beware not to destroy the work we just did on the hair. The important part of the hair mask are the hair "borders", so you can also go and paint the hair "mass" in full white, keeping the greyscale levels on the border,
  7. if you still have too much noise in the background, you can use the threshold tool to clean it a bit. However, this tool will loose some of the details in the hairs, so don’t go too far with it,
  8. you will now have a pretty good black and white layer that can be transferred to a layer mask to extract the hair. The easiest is to go to the channel list and transfer one of the channel to selection,
  9. go to your original layer, add a layer mask, filled in black (full transparency),
  10. fill the selection, in the layer mask, with white colour. Only the hair and the head should now be shown from the original layer,
  11. you can erase the layer we used to build the mask, and work directly on the mask of the original layer to extract the rest of the body (as shown at the beginning of the video).
Date of online publication: 21 November 2007
last-update: 30 January 2008
Forum messages 6
visits:
9934

Creative Commons Attribution NonCommercial ShareAlike 2.5  License

notes

[1] Yes, you might never have realized that, but it’s possible to have fuzzy selections in The Gimp.

[2] this will depend on the colours of the background and foreground

[3] see how in the video

 

P.S.

This tutorial was triggered by Perfect masking using a highpass that uses a very similar approach but is a bit confusing I think.

Reply to this article

6 Forum messages

 

The most read articles

Photos On Flickr

 
©
Pierre Andrews
York, uk
| Site Map | Site created with SPIP 1.9.2d [11132] | RSS | template by IZO, Mortimer. |
Fernando tiramisu authors before the
Fernando tiramisu authors before the
Fernando tiramisu authors before the
Fernando tiramisu authors before the
Fernando tiramisu authors before the