Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

5.5. Threshold Tool

Revision History
Revision $Revision: 1.28 $ 2006-06-18 j.h

The Threshold tool transforms the current layer or the selection into a black and white image, where white pixels represent the pixels of the image whose Value is in the threshold range, and black pixels represent pixels with Value out of the threshold range.

You can use it to enhance a black and white image (a scanned text for example) or to create selection masks.

[Note] Note

As this tool creates a black and white image, the anti-aliasing of the original image disappears. If this poses a problem, rather use the Levels tool.

5.5.1. Activate Tool

The Threshold Tool can be called in the following order, from the image-menu: Tools->Color Tools->Threshold,

or by clicking on the icon in Toolbox if this tool has been installed in it. You can do that through the Tool dialog.

5.5.2. Options

Figure 8.63.  Threshold tool options

Threshold tool options
Threshold range

The Threshold tool provides a visual graph, a histogram, of the intensity value of the active layer or selection. You can set the threshold range either using the input boxes or clicking button 1 and dragging on the graph. It allows you to select a part of the image with some intensity from a background with another intensity. Pixels inside the range will be white, and the others will be black. Adjust the range to get the selection you want in white on black background.

Preview

The Preview toggle allows dynamic updating of the active layer or selection while changes are made to the intensity level.

5.5.3.  Using Threshold and Quick Mask to create a selection mask

That's not always the case, but an element you want to extract from an image can stand out well against the background. In this case, you can use the Threshold tool to select this element as a whole. Grokking the GIMP described a method based on a channel mask, but now, using the Quick mask is easier.

  1. First start decomposing you image into its RGB and HSV components by using the Decompose filter. A new grey-scaled image is created and the components are displayed as layers in the Layer Dialog. These layers come with a thumbnail but it is too small for an easy study. You can, of course, increase the size of this preview with the dialog menu (the small triangular button), but playing with the “eyes ” is more simple to display the wanted layer in the decompose image. Select the layer that isolates the element the best.

    Figure 8.64.  The original image, the decompose image and its Layer Dialog

    The original image, the decompose image and its Layer Dialog
    The original image, the decompose image and its Layer Dialog
    The original image, the decompose image and its Layer Dialog
  2. Call the Threshold tool from the decompose image. By moving the black cursor, fit threshold to isolate the best the element you want to extract. This will probably not be perfect: we will enhance the result with the selection mask we are going to create.

    [Warning] Warning

    Make sure you have selected the right layer when you call the Threshold tool: when it is opened, you can't change to another layer.

    Figure 8.65.  The selected layer after threshold fit

    The selected layer after threshold fit

    We got the best outline for our flower. There are several red objects which we must remove.

  3. Make sure the image displaying the selected layer is active and copy it to the clipboard with Ctrl-C.

  4. Now, make the original image active. Click on the Quick Mask button at the bottom-left corner of the image window: the image gets covered with a red (default) translucent mask. This red color does not suit well to our image with much red: go to the Channel Dialog, activate the “Quick mask” channel and change this color with the Edit Channel Attributs. Come back to the original image. Press Ctrl-V to paste the previously copied layer.

    Figure 8.66.  The mask

    The mask
  5. Voilà. Your selection mask is ready: you can improve the selection as usually. When the selection is ready, disable the Quick mask by clicking again on its button: you will see the marching ants around the selection.

    Figure 8.67.  The result

    The result
    The result

    We used the Zoom to work at a pixel level, the Lasso to remove large unwanted areas,the pencil (to get hard limits), black paint to remove selected areas, white paint to add selected areas, especially for stem.


 
 
  Published under the terms of the GNU General Public License Design by Interspire