Determining Intensity Values for Threshold and Stretch

Thresholding and stretching images separate foreground pixels from background pixels and can be performed before or after applying a morphological operation to an image. While a threshold operation produces a binary image and a stretch operation produces a scaled, grayscale image, both operations rely upon the definition of an intensity value. This intensity value is compared to each pixel value within the image and an output pixel is generated based upon the conditions stated within the threshold or stretch statement.

Intensity histograms provide a means of determining useful intensity values as well as determining whether or not an image is a good candidate for thresholding or stretching. A histogram containing definitive peaks of intensities indicates that an image's foreground and background features can be successfully separated. A histogram containing connected, graduated ranges of intensities indicates the image is likely a poor candidate for thresholding or stretching.

Figure 9-1: Determining Appropriateness of Images for Thresholding or Stretching Using Intensity Histograms

Determining_Intensity_Values_for_Threshold_and_Stretch-35.jpg

Note
To quickly view the intensity histogram of an image, create a window and use PLOT in conjunction with HISTOGRAM, entering PLOT, HISTOGRAM(image) where image denotes the image for which you wish to view a histogram.

Thresholding an Image

Thresholding outputs a binary image as determined by a threshold intensity and one of the relational operators: EQ, NE, GE, GT, LE, or LT. In a statement containing a relational operator, thresholding compares each pixel in the original image to a threshold intensity. The output pixels (comprising the binary image) are assigned a value of 1 (white) when the relational statement is true and 0 (black) when the statement is false.

The following figure shows an intensity histogram of an image containing mineral crystals. The histogram indicates that the image can be successfully thresholded since there are definitive peaks of intensities. Also shown in the following figure, a statement such as img LE 50 produces an image where all pixels less than the threshold intensity value of 50 are assigned a foreground pixel value of 1 (white). The statement, img GE 50 produces a contrasting image where all original pixels values greater than 50 are assigned a foreground pixel value (white).

Figure 9-2: Image Thresholding

imgmorph02.jpg

Stretching an Image

Stretching an image (also know as scaling) creates a grayscale image, scaling a range of selected pixel values across all possible intensities. When using TVSCL or BYTSCL in conjunction with the > and < operators, a range of pixels defined by the intensity value and operator are scaled across the entire intensity range, (0 to 255).

The following figure shows the results of displaying each image stretching statement using TVSCL, image:

Figure 9-3: Image Stretching

imgmorph03.jpg