Image Segmentation
Professor Dr. Rafiqul Islam
Dept of CSE
Image Segmentation
• Segmentation divides an image into its constituent
regions or objects.
• Segmentation of images is a difficult task in image
processing. Still under research.
• Segmentation allows to extract objects in images.
What it is useful for
• After a successful segmenting the image, the contours
of objects can be extracted using edge detection and/
or border techniques.
• Shape of objects can be described.
• Based on shape, texture, and color objects can be
identified.
• Image segmentation techniques are extensively used
in similarity searches.
Applications
• Object Detection
• Face Recognition
• Finding objects in Satellite images
• Traffic control systems
• Medical imaging
Segmentation Algorithms
• Segmentation algorithms are based on one of two
basic properties of color, gray values, or texture:
discontinuity and similarity.
• First category is to partition an image based on
abrupt changes in intensity, such as edges in an image.
• Second category are based on partitioning an image
into regions that are similar according to a predefined
criteria. Histogram thresholding approach falls under
this category.
Segmentation Algorithms
• Grey-Level Segmentation
– Thresholding with a single threshold
– Thresholding with a pair of thresholds
Segmentation Algorithms
• If we want to divide the image into two regions (object and
background), we define a single threshold value. This is
known as the global threshold.
• If we have multiple objects along with the background, we
must define multiple thresholds. These thresholds are
collectively known as the local threshold.
Grey-Level Segmentation
• Thresholding with a single threshold
• Grey-level thresholding applies to every pixel by the
rule:
{1, 𝑓(𝑥, 𝑦) ≥ 𝑇
0, 𝑓(𝑥, 𝑦) < 𝑇
𝑔(𝑥, 𝑦) =
• Where T is the threshold value.
Grey-Level Segmentation
• Thresholding with a pair threshold
• Grey-level thresholding using a pair of threshold value
applies to every pixel by the rule:
𝑓(𝑥, 𝑦) < 𝑇1
0
{0
𝑔(𝑥, 𝑦) = 1 𝑇1 ≤ 𝑓(𝑥, 𝑦) ≤ 𝑇2
𝑓(𝑥, 𝑦) > 𝑇2
• Where 𝑇1 and 𝑇2 are two threshold value that defines
a range of acceptable grey levels.
Grey-Level Segmentation
• Optimal Thresholding (Iterative threshold determination)
1. Compute μ1, the mean grey level of the corner pixels
2. Compute μ2, the mean grey level of all other pixels
3. Told = 0
4. Tnew = (μ1 + μ2)/2
5. While Tnew ≠ Told do
i. μ1 = mean grey level of pixels for which f(x, y) < Tnew
ii. μ2 = mean grey level of pixels for which f(x, y) ≥ Tnew
iii. Told = Tnew
iv. Tnew = (μ1 + μ2)/2
6. End while
Otsu Segmentation
• Otsu method is a clustering based image thresholding.It works
when the histogram is bimodal.
• The method basically tries to minimize the within class variance
and at the same time it maximizes the between class variance.
• Total variance=Within class variance +Between Class Variance.
Otsu Segmentation
• Create Histogram from the grey scale image
• Based on threshold value (t), separated the image into two class:
Class 1 (value<=t) and Class 2 (value>t)
• Compute variance:
• Compute within class variance: number of pixels in class/
Otsu Segmentation
Otsu Segmentation
Otsu Segmentation
Otsu Segmentation
• Histogram of a 3-bit image is shown in
• Gray level : 0 1 2 3 4 5 6 7
• Number of pixels: 2 3 2 1 2 3 2 1
• Find optimal threshold using Otsu.
Otsu Segmentation
Other Segmentation method
• Edge-based
– Point
– Line
– Edge detection
• Region-based
– Seeded region growing
– Unseeded region growing
– Fast scanning
18
Edge-based segmentation
• Point/edge detection
a point detection mask
• Line detection
a line detection mask
19
Region-based segmentation
• Region-based segmentation is a technique for
determining the region directly. The basic
formulation is:
(a) R = i=1,..N U R(i)
(b) R(i) ∩ R(j) = 0 for i ≠ j
(c) P(R(i)) = TRUE for i = 1,2,…,N
(d) R(i) is a connected region, I = 1,…,N
(e) P(R(i) U R(j)) = FALSE for i ≠ j
Region-based segmentation
P(R(i)) is a logical predicate defined over the points in
set and is the null set:
– (a) means that the segmentation must be complete; that is,
every pixel must be in a region.
– (b) requires that points in a region must be connected in
some predefined sense.
– (c) indicates that the regions must be disjoint.
– (d) deals with the properties that must be satisfied by the
pixels in a segmented region. For example if all pixels
in have the same grayscale.
– (e) indicates that region and are different in the sense of
predicate .
Seeded Region Growing (SRG)
• Region growing: Groups pixels or sub-region
into larger regions.
– step1:
• Start with a set of “seed” points and from these grow
regions by appending to each seed those neighboring
pixels that have properties similar to the seed.
– step2:
• Region splitting and merging
22
Region-based segmentation
SRG
• Advantage:
– With good connectivity
• Disadvantage:
– Initial seed-points:
• different sets of initial seed-point cause different
segmented result
– Time-consuming problem
23
Region-based segmentation
USRG
• Unseeded region growing:
– no explicit seed selection is necessary, the seeds can
be generated by the segmentation procedure
automatically.
– It is similar to SRG except the choice of seed point
24
Region-based segmentation
USRG
• Advantage:
– easy to use
– can readily incorporate high level knowledge of the
image composition through region threshold
• Disadvantage:
– slow speed
25
Region-based segmentation
fast scanning
• Fast scanning Algorithm:
– The fast scanning algorithm
somewhat resembles unseeded
region growing
– the number of clusters of both
two algorithm would not be
decided before image passing
through them.
26
Region-based segmentation
fast scanning
27
Region-based segmentation
fast scanning
• Last step:
– merge small region to big
region
28
Region-based segmentation
fast scanning
• Advantage:
– The speed is very fast
– The result of segmentation will be intact with good
connectivity
• Disadvantage:
– The matching of physical object is not good
• It can be improved by morphology and geometric
mathematics
29
Recent Methods
• Deep Learning based segmentation
• Feature extraction based segmentation
• Cluster based segmentation
30