Thresholding an Image
Table of Contents
Description
Thresholding consists of segmenting an image into two regions: a particle region and a background region. In its most simple form, this process works by setting to white all pixels that belong to a gray-level interval, called the threshold interval, and setting all other pixels in the image to black. The resulting image is referred to as a binary image. For color images, three thresholds must be specified, one for each color component.The threshold can be chosen manually or by using automated techniques. Manual threshold selection is normally done by trial and error, using a histogram as a guide. The example below, taken from Chapter 7 of the IMAQ Vision User Manual, shows a threshold chosen to isolate the brightest particles from an image:

Automated thresholding techniques select a threshold which optimizes a specified characteristic of the resulting images. These techniques include clustering, entropy, metric, moments, and interclass variance. Clustering is unique in that it is a multi-class thresholding method. In other words, instead of producing only binary images it can specify multiple threshold levels which result in images with three or more gray-level values.
Common Applications
Thresholding is the most common method of segmenting images into particle regions and background regions. A typical processing procedure would start with filtering or other enhancements to sharpen the boundaries between objects and their background. Then, the objects are separated from the background using thresholding.
What To Expect
The binary image resulting from the above thresholding operation is shown here:

The light particles are separated in the binary image, while the various darker shades of gray are all set to black. Various morphological operations can be used to further refine the image by filling small holes, deleting small particles and joining or separating adjacent particles.
Related Links:
IMAQ Vision User Manual
Reader Comments | Submit a comment »
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
