Extract objects from images with ease

Overview

The following describes how Decompose can be used to extract objects from images. We will cover the following topics:

  1. Requirements
    Prerequisites to successfully complete this tutorial.
  2. Choosing a good image
    Explaining which type of images is best suited for object extraction.
  3. Drawing a mask
    Drawing a coarse mask as the initial approximation of the objects.
  4. Saving the result
    Saving the newly extracted objects as a transparent TIFF image.
  5. Tips for obtaining better results
    Some tips to improve the extraction and get better results.

Requirements

Before starting this tutorial, make sure you have the following items available:

  • Latest version of Decompose
  • Mac OS X 10.9 or higher
  • If you will be adding the objects to another image, you will need a software such as Adobe Photoshop

Choosing a good image

Unfortunately, not all images are well suited for the extraction of objects. The perfect image has a smooth uniform background and the objects to extract have sharp edges with colors different from the background.

However, most of the time such images are not available. Decompose works well to extract objects from these non-ideal images. Even if your picture has a complex background, if you can clearly distinguish the edges of the objects visually, Decompose will succesfully extract these objects.

a well-suited image an unsuited image

In this tutorial, we will be working with the image of the dog. Feel free to download a larger version.

Once you are ready, launch Decompose. You will be prompted to choose the desired image.

Drawing a mask

Once your image is loaded in Decompose, the first step is to give the application a rough idea of the objects to extract. The following tools are available to perform this task:


Brush Tool
Paints a thick line. The thickness of the line can be adjusted with the Size slider.

Fill Tool
Paints a closed region.

Region Tool
Paints a region defined by an arbitrary shape.

Rectangle Tool
Paints a region defined by a rectangle.

Color Tool
Paints all the pixels with a similar color. The tolerance can be adjusted with the Tolerance slider.

Three regions must be defined when you draw the mask:


Foreground
Pixels in this region are fully part of the objects to be extracted.

Contour
Pixels in this region are either part of the foreground or the background. Decompose will automatically determine it.

Background
Pixels in this region are fully part of the background to be removed.

When drawing the initial mask, Decompose shows the original image with slightly modified colors so you can view to which region each pixel belongs. Dark pixels belong to the background, medium pixels to the contour and light pixels to the foreground. Initially, all pixels in the image are considered to be in the background region and your image seems darker.

The next step is to switch to the Contour mode and use the Brush tool to roughly trace the contour of the objects you wish to extract. It is important that you completly cover the edges of the objects to extract since Decompose will look for the edges only in the marked contour regions.

Then, switch to the Foreground mode and use the Fill tool to fill the objects to extract with the foreground color. When using the Fill tool to paint the foreground make sure that the contour you previously draw forms a closed shape, otherwise it will spill. If the contour is not a closed shape, you can use one of the other tools at your disposition to paint the foreground.

That's it! You have now succesfully drawn the mask required by Decompose in order to appropriately extract the objects from the image. Note that at any time, you can use the Image/Mask slider to change the view between the original image and the mask. Now that the mask is drawn, Decompose is ready to perform the rest of the extraction automatically.

Saving the result

Click on Result or Matte to initiate the automatic extraction. Decompose will take some time to analyze and process the image and mask before producing the result. The result is then displayed on a translucent background. You can change the color and translucency of the background to test the result using the Background color button found in the right-hand bottom corner of the window.

Finally, you can click on Save from the File menu to save the result as a TIFF image. This image contains the color-corrected extracted objects on a transparent background and is ready to be used in your favorite compositing software.

Tips for obtaining better results

The following tips will make it easier for Decompose to understand which objects you want to extract and help you obtain better results:

Draw an accurate mask
Provide as much information about the foreground, contour and the background regions as possible. In other words, be as precise as possible when covering the edges of the objects to extract when you draw the original mask. Not only will it help you obtain better results but it will also reduce the processing time.
Refine your result
If part of the resulting image is incorect, go back to your mask and refine it around the troublesome area. It is a good idea to first draw a rough contour of the objects to exract, inspect the result and then go back to correct the problematic areas.
Increase the matte contrast
Sometimes, Decompose will produce a result where part of the extracted objects are slightly transparent or where sections of the original background are slightly visible. You can correct this using the Alpha slider present in the Result and Matte tabs. When the Alpha slider is to the right, there will be no translucency and everything will be either opaque or transparent.
Provide accurate information
Make sure you did not include foreground pixels in the background regions or vice versa. Decompose assumes the information you provide is always accurate. If you enter incorrect information Decompose will not be able to produce optimal results.