# Threshold Image

Certain types of images resist both thresholding and pixel mapping approaches to segmentation. These images are frequently of scenes that contain a variety of gradient or other lighting problems that result in the presence of the same pixel values in both the object and the background. The following figure shows an example of a scene that cannot be segmented using thresholding or pixel mapping.

Because certain background pixel values are the same as object pixel values, the image cannot be segmented using thresholding or pixel mapping. If you obtain a reference image of the scene where the object is absent, you can segment the image by comparing each pixel in the image to segment with the corresponding pixel in the reference, or threshold, image. Each pixel that differs between the two images by more than a certain amount is assigned as an object pixel. Pixels that are the same between the two images are assigned as background pixels. This technique is known as using a threshold image.

Using a threshold image to segment an image involves supplying a threshold image of the scene where the object is absent and a threshold value. When an actual image is segmented, every pixel in the image to be segmented that differs from the corresponding pixel in the threshold image by a supplied threshold value is treated as an object pixel. All pixels that do not differ from the corresponding pixel in the threshold image are treated as background pixels. The following figure illustrates the use of a threshold image.