55:148 Digital Image Processing
Chapter 5, Part I
Segmentation: Thresholding
Related Reading
Sections from Chapter 5 according to the WWW Syllabus.
Chapter 5.1 Overview:
Segmentation
- one of the most important steps leading to the analysis of processed image data
- its main goal is to divide an image into parts that have a strong correlation with
objects or areas of the real world contained in the image
- complete segmentation - set of disjoint regions uniquely corresponding with objects in
the input image
- cooperation with higher processing levels which use specific knowledge of the problem
domain is necessary
- partial segmentation - regions do not correspond directly with image objects
- image is divided into separate regions that are homogeneous with respect to a chosen
property such as brightness, color, reflectivity, texture, etc.
- in a complex scene, a set of possibly overlapping homogeneous regions may result. The
partially segmented image must then be subjected to further processing, and the final
image segmentation may be found with the help of higher level information.
- Simple segmentation problems:
- contrasted objects on a uniform background
- simple assembly tasks, blood cells, printed characters, etc.
- Totally correct and complete segmentation of complex scenes usually cannot be achieved
in this processing phase
- A reasonable aim is to use partial segmentation as an input to higher level processing.
- Segmentation problems:
- image data ambiguity
- information noise
- Segmentation methods
- global approaches, e.g. using histogram of image features
- edge-based segmentations
- region-based segmentations
- Characteristics used in edge detection or region growing
- brightness
- texture
- velocity field
- etc.
- Edge-based and region-bases segmentation approaches solve a dual problem ... border x
region.
- Because of the different natures of the various edge- and region-based algorithms, they
may be expected to give somewhat different results and consequently different information.
- The segmentation results of these two approaches can therefore be combined in a single
description structure, e.g., a relational graph
Thresholding
- Gray level thresholding is the simplest segmentation process.
- Many objects or image regions are characterized by constant reflectivity or light
absorption of their surface.
- Thresholding is computationally inexpensive and fast.
- Thresholding can easily be done in real time using specialized hardware.
- Complete segmentation can result from thresholding in simple scenes.
- Thresholding algorithm
- Search all the pixels f(i,j) of the image f. An image element g(i,j) of the segmented
image is an object pixel if f(i,j) >= T, and is a background pixel otherwise.
Practical Experiment 5.A - VIP Version
- Save the rabbit.jpg image to your
diphome directory.
- Open VIP and invoke threshold.vip
- By trial and error, determine the threshold segmenting the rabbit from the
background. To do this, adjust the upper and lower thresholds (upperT, lowerT)
found in the Properties box.
- Determine the interval in which the threshold has to be defined to perform the
desired segmentation.
- Now, apply the same approach to segmentation of the airplane use the image airplane.jpg - did you find a suitable
threshold?
Note: to use these images with threshold.vip you may need to resize
the xsize and ysize properties of the Threshold node.
The sizes of some test images are below.
Practical Experiment 5.A - Khoros Version
- Open Cantata and invoke threshold.wksp
- By trial and error, determine the threshold segmenting the rabbit from the
background.
- Determine the interval in which the threshold has to be defined to perform the
desired segmentation.
- Now, apply the same approach to segmentation of the airplane use the image airplane.kdf
- did you find a suitable threshold?
- Correct threshold selection is crucial for successful threshold segmentation
- Threshold selection can be interactive
- or can be the result of some threshold detection method
- Single global threshold ... successful only under very unusual circumstances
- gray level variations are likely - due to non-uniform lighting, non-uniform input device
parameters or a number of other factors.
- Variable thresholding (also adaptive thresholding), in which the threshold
value varies over the image as a function of local image characteristics, can produce the
solution in these cases.
- image f is divided into subimages fc
- a threshold is determined independently in each subimage
- if a threshold cannot be determined in some subimage, it can be interpolated from
thresholds determined in neighboring subimages.
- each subimage is then processed with respect to its local threshold.
Practical Experiment 5.B (not in class) - VIP Version
- Open VIP and invoke threshold.vip
- Using the airplane.jpg image,
modify the thresholding project to perform adaptive thresholding - divide the image in
blocks or write a program to do that.
- Did the segmentation improve?
Practical Experiment 5.B (not in class) - Khoros
Version
- Open Cantata and invoke threshold.wksp
- Using the airplane.kdf image, modify the thresholding workspace to perform
adaptive thresholding - divide the image in blocks or write a program to do that.
- Did the segmentation improve?
- Thresholding modifications:
- Band-thresholding
- segment an image into regions of pixels with gray levels from a set D and into
background otherwise
- Can also serve as border detection
Practical Experiment 5.C - VIP Version
- Open VIP and invoke threshold.vip
- Using the rabbit.jpg image, select
an appropriate thresholding node ( and/or thresholding parameters ) to perform
band-thresholding-based border detection.
- Some useful VIP thresholding nodes (simply change the threshold parameters in the
Properties box):
- Try to apply this idea to the airplane.jpg
image and the textsheet.jpg.
Practical Experiment 5.C - Khoros Version
- Open Cantata and invoke threshold.wksp
- Using the rabbit.pgm image, select an appropriate thresholding glyph to
perform band-thresholding-based border detection.
- Try to apply this idea to the airplane.kdf image and the textsheet.pgm.
- Multithresholding
- resulting image is no longer binary
- Semithresholding
- aims to mask out the image background leaving gray level information present in the
objects
Practical Experiment 5.D - VIP Version
- Open VIP and invoke threshold.vip
- Using the rabbit.jpg image, select
an appropriate thresholding glyph to perform semi-thresholding - segment the background
and keep the rabbit gray level information.
- Some helpful VIP nodes:
- Note: to use these nodes, the user must adjust both the thresholding parameters of the
nodes AND the image size. The sizes of some test images are below.
Practical Experiment 5.D - Khoros Version
- Open Cantata and invoke threshold.wksp
- Using the rabbit.pgm image, select an appropriate thresholding glyph to
perform semi-thresholding - segment the background and keep the rabbit gray level
information.
- Thresholding can also be applied to
- gradient
- local texture
- any other image decomposition criterion
Threshold detection methods
- If some property of an image after segmentation is known a priori, the task of threshold
selection is simplified, since the threshold is chosen to ensure this property is
satisfied.
- A printed text sheet may be an example if we know that characters of the text cover 1/p
of the sheet area.
- P-tile-thresholding
- choose a threshold T (based on the image histogram) such that 1/p of the image area has
gray values less than T and the rest has gray values larger than T
- in text segmentation, prior information about the ratio between the sheet area and
character area can be used
- if such a priori information is not available - another property, for example the
average width of lines in drawings, etc. can be used - the threshold can be determined to
provide the required line width in the segmented image
- More complex methods of threshold detection
- based on histogram shape analysis
- bimodal histogram - if objects have approximately the same gray level that
differs from the gray level of the background
Practical Experiment 5.E - VIP Version
Practical Experiment 5.E - Khoros Version
- Open Cantata and invoke threshold.wksp
- Using the rabbit.pgm image, display its gray level histogram
- Is the histogram bimodal?.
- What about for the airplane.kdf image? Or the textsheet.pgm?
- Threshold-based segmentation ... minimum segmentation error requirements
- it makes intuitive sense to determine the threshold as the gray level that has a minimum
histogram value between the two mentioned maxima
- multimodal histogram - more thresholds may be determined at minima between any two
maxima.
- Bimodality of histograms
- to decide if a histogram is bimodal or multimodal may not be so simple in reality
- it is often impossible to interpret the significance of local histogram maxima
- Bimodal histogram threshold detection algorithms
- Mode method - find the highest local maxima first and detect the threshold as a
minimum between them
- to avoid detection of two local maxima belonging to the same global maximum, a minimum
distance in gray levels between these maxima is usually required
- or techniques to smooth histograms are applied
- Histogram bimodality itself does not guarantee correct threshold segmentation
- Optimal thresholding
- based on approximation of the histogram of an image using a weighted sum of two or more
probability densities with normal distribution
- The threshold is set as the closest gray level corresponding to the minimum probability
between the maxima of two or more normal distributions, which results in minimum error
segmentation
- Problems - estimating normal distribution parameters together with the uncertainty that
the distribution may be considered normal.
- The method performs well under a large variety of image contrast conditions
- Example - Brain MR image segmentation
- A combination of optimal and adaptive thresholding
- determines optimal gray level segmentation parameters in local subregions for which
local histograms are constructed
- gray-level distributions corresponding to n individual (possibly non-contiguous) regions
are fitted to each local histogram that is modeled as a sum of n Gaussian distributions so
that the difference between the modeled and the actual histograms is minimized
- Variable g represents gray level values from the set G of images gray levels, ai,
&sigmai and µi denote parameters of the Gaussian distribution
for the region i.
- The optimal parameters of the Gaussian distributions are determined by minimizing the
fit function F
- Applied to segmentation of MR brain images, three segmentation classes - WM, GM, CSF
Multispectral thresholding
- Multispectral or color images
- One segmentation approach determines thresholds independently in each spectral band and
combines them into a single segmented image.
Hierarchical Thresholding
Last Modified: October 5,2000