You are on page 1of 13

Basic Global Thresholding

Problem
• Original image often
has inconsistencies
due to light and noise.

• Ideal image is
composed of the
fewest possible
distinct intensities.
Solution!
• Segment original image.
– Represents a range of intensities with one
intensity.
– Allows user or machine to more easily
determine which pixels belong to which
object.
Approaches to Segmentation
• Discontinuity
– Partitions image based on abrupt changes in
intensities.
– Aims to find edges.
• Similarity
– Partitions image based on groups of pixels
which fall into the same intensity range.
Thresholding
• Similarity Approach
– Pick a threshold T
• Pixels above threshold get new intensity A.
• Pixels below threshold get new intensity B.

Partition 1 Threshold = 128 Partition 2


Picking a Threshold
• Analyze Histogram
– Peak and Valley Method
• Find the two most prominent peaks in the histogram.
• Find the deepest valley between the two peaks.
• Use the gray value of the deepest valley.
Valley

Peak
Peak
Multiple Thresholds
• Images whose histograms have multiple peaks may
benefit from multiple thresholds.
– A set of thresholds
• T = {T1, T2, T3, T4, …………, Tn}
– New intensity of gg(x,y)
( x, y ) is given by:

A g ( x, y ) ≤ T 1
B T 1 < g ( x, y ) ≤ T 2

g ' ( x, y ) = 
C T 2 < g ( x, y ) ≤ T 3
 D T 3 < g ( x, y )
Requirements
• Works well when:
– Objects in image do not touch each other.
– Objects’ intensities are distinct from
background’s intensities.
– Appropriate threshold is chosen by the user or
algorithm.
Implementation
• Find threshold and values for ranges
– 1 Threshold
• Find valley between largest two peaks.
– N Thresholds
• Use clustering to find ranges between thresholds.
• For each pixel in image decide which
range it fits in.
• Assign new value to that pixel.
Simple Form of Thresholding
• Basic Global Thresholding
– Uses a single set of thresholds for the entire
image.
– Only considers a single pixel at a time.
• Adaptive Thresholding
– Changes thresholds to best suit current part
of image being analyzed.
Examples

Note the Shadows

Original Image

Original Histogram

Threshold

Resulting Image
Examples
Note the Noise

Original Histogram

Original Image

Threshold

Background removed
Noise Remains •Finger print is
more distinct.
•Same intensity Resulting Image
as fingerprint.
Poor Result Example

Original Image Resulting Image

• Gradient in original image makes it hard to


determine threshold.
• Resultant image is useless as much of the
shape is lost.

You might also like