Image Segmentation Techniques Overview
Image Segmentation Techniques Overview
Module 5
Image Segmentation
1
8/3/2022
• Local Segmentation
– Segmenting sub-images which are small windows on a
whole image
– Number of pixels available will be lower than the global
segmentation
• Global Segmentation
– Concerned with segmenting a whole image
– Global segmentation deals with segments consisting of a
relatively large number of pixels
– This makes estimated parameter values for global
segments more robust
Approaches to segmentation
• fundamentally two kinds of approaches to
segmentation on the basis of properties of pixels:
discontinuity and similarity.
2
8/3/2022
3
8/3/2022
4
8/3/2022
Region-Based Segmentation
Region-Based Segmentation
Basic Formulation
5
8/3/2022
Region Growing
• Groups pixels or sub-regions into larger regions based on
predefined criteria.
• The basic idea is to 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
(specified ranges of gray level or colour)
• Seed points are found out by computing at every pixel value
the same set of properties that ultimately will be used to
assign pixels to regions during growing process.
• If the result of these computations show cluster of values, the
pixels whose properties place them near the centroid can be
used as seeds
6
8/3/2022
Region Growing Process. (a) sample point cloud; (b) one seed point selected; (c) 10 nearest
neighbor points added; (d) 100 nearest neighbor points added; (e) 1000 nearest neighbor
points added; (f) 2000 nearest neighbor points added; (g) all neighbor neighbor points
added, region is complete.
7
8/3/2022
8
8/3/2022
9
8/3/2022
10
8/3/2022
Clustering Techniques
• Clustering (cluster analysis) is grouping objects
based on similarities
• Clustering can be used in many areas, including
machine learning, computer graphics, pattern
recognition, image analysis, information retrieval,
bioinformatics, and data compression
• Clustering
– Hierarchical
– Partitional
Clustering
Hierarchical Partitioning
11
8/3/2022
Hierarchical Clustering
• Hierarchical clustering is a method of cluster analysis
which seeks to build a hierarchy of clusters
• Hierarchical clustering which is used to group the
unlabeled datasets into a cluster and also known
as hierarchical cluster analysis or HCA.
• In this algorithm, the hierarchy of clusters is
developed in the form of a tree, and this tree-shaped
structure is known as the dendrogram.
12
8/3/2022
13
8/3/2022
• Repeat the above three steps until K becomes 0 to form one big
cluster. No more data points are left to join
14
8/3/2022
15
8/3/2022
Linkage Criteria:
Divisive Clustering
• Divisive hierarchical clustering is exactly the
opposite of Agglomerative Hierarchical clustering.
• In Divisive Hierarchical clustering, all the data
points are considered an individual cluster, and in
every iteration, the data points that are not
similar are separated from the cluster.
• The separated data points are treated as an
individual cluster. Finally, we are left with N
clusters.
16
8/3/2022
17
8/3/2022
Partition Clustering
• Uses an iterative optimisation procedure that aims at minimising
an objective function f
• f measures the goodness of clustering
• Composed of 2 learning steps
– Partitioning of each pattern to its closest cluster
– Computation of the cluster centroids
• Clustering Procedure start from an initial solution with a
known number of clusters
• Categorised into
• Probabilistic clustering
• K-medoids
• K-means Clustering
18
8/3/2022
K means clustering
• our aim here is to minimize the distance between the
points within a cluster
• There is an algorithm that tries to minimize the distance
of the points in a cluster with their centroid – the k-means
clustering technique
• K-means is a centroid-based algorithm, or a distance-
based algorithm, where we calculate the distances to
assign a point to a cluster. In K-Means, each cluster is
associated with a centroid
• The main objective of the K-Means algorithm is to
minimize the sum of distances between the points and
their respective cluster centroid.
K-Means Clustering
• It is an iterative procedure
• Clusters data by iteratively computing a mean
intensity for each class and segmenting the image by
classifying each pixel in the class with the closest
means
19
8/3/2022
20
8/3/2022
21
8/3/2022
22
8/3/2022
23
8/3/2022
Global Thresholding
• A threshold value T is chosen as the threshold
24
8/3/2022
25
8/3/2022
26
8/3/2022
27
8/3/2022
28
8/3/2022
Adaptive Thresholding
• In many cases, background gray level is not a constant
• Object contrast varies within an image
• So, threshold in one area might not work well in other
areas of the image.
• So, global thresholding can’t be used there
• Adaptive Thresholding
– Divide the image into sub-images
– Assume that the illumination in each sub-images is constant.
– Use a different threshold for each sub-image.
– Alternatively – use a running window (and use the threshold
of the window only for the central pixel )
29
8/3/2022
Detection of Discontinuities
30
8/3/2022
Detection of Discontinuities
Point Detection
R T
where T : a nonnegative threshold
Detection of Discontinuities
Line Detection
31
8/3/2022
Region-Based Segmentation
32
8/3/2022
Region-Based Segmentation
Basic Formulation
33
8/3/2022
EDGE DETECTION
CONTENTS
• Introduction
• Types of Edges
• Steps in Edge Detection
• Methods of Edge Detection
– First Order Derivative Methods
• First Order Derivative Methods - Summary
– Second Order Derivative Methods
• Second Order Derivative Methods - Summary
– Optimal Edge Detectors
• Canny Edge Detection
1
8/3/2022
INTRODUCTION
2
8/3/2022
TYPES OF EDGES
• Variation of Intensity /
Gray Level
– Step Edge
– Ramp Edge
– Line Edge
– Roof Edge
3
8/3/2022
Noisy Image
• Example of Noisy Image
4
8/3/2022
5
8/3/2022
First Derivative
• At the point of greatest
slope, the first derivative
has maximum value
– E.g. For a Continuous 1-
dimensional function f(t)
Detection of Discontinuities
Gradient Operators
• First-order derivatives:
– The gradient of an image f(x,y) at location (x,y) is defined
as the vector:
Gx fx
f f
G y y
– The magnitude of this vector: f mag(f ) G x2 G y2
1
2
Gx
– The direction of this vector: ( x, y ) tan 1
G
y
6
8/3/2022
7
8/3/2022
8
8/3/2022
Robert Operator
• Main objective is to determine the differences
b/w adjacent pixels.
• Use {+1, -1} that calculates the difference
between adjacent pixels (Forward differences)
• Roberts kernels are too small to reliably find
edges in the presence of noise (Disadvantage)
9
8/3/2022
Prewitt Kernel
• Masks of 2X2 are not easy to implement because they do not have clear
centre.
• An approach is to find the gradient using 3X3 mask
• In this formulation, the difference between the first and third rows of 3x3
image region approximates the derivative in x direction, and the difference
between third and first columns approximates the derivate in y direction
10
8/3/2022
Advantages:
• Good performance on detecting vertical and horizontal edges
• Best operator to detect the orientation of an image
• Prewitt mask differentiates in one direction and averages in other
direction . So, edge detector is less vulnerable to noise
Limitations:
• The magnitude of coefficient is fixed and cannot be changed
• Diagonal direction points are not preserved always
Sobels Kernel
• Relies on central differences but gives greater
weight to the central pixels when averaging
11
8/3/2022
Sobels Kernel
12
8/3/2022
Detection of Discontinuities
Gradient Operators: Example
f G x G y
13
8/3/2022
Detection of Discontinuities
Gradient Operators: Example
14
8/3/2022
15
8/3/2022
Laplacian Filter
The Laplacian is defined as follows:
2 f 2 f
f 2 2
2
x y
2 f
f ( x 1, y ) f ( x 1, y ) 2 f ( x, y )
2 x
2 f
f ( x, y 1) f ( x, y 1) 2 f ( x, y )
2 y
32
16
8/3/2022
Laplacian Filter
0 1 0
33
Laplacian Filter
34
17
8/3/2022
Effect of noise
18
8/3/2022
19
8/3/2022
Detection of Discontinuities
Gradient Operators
20
8/3/2022
21
8/3/2022
22
8/3/2022
x2 y2 x2 y2
( ) ( )
2 12 2 2 2
DoG ( x, y ) e e
23
8/3/2022
24
8/3/2022
25
8/3/2022
26
8/3/2022
G Gx 2 Gy 2 Gx Gy
Gy
tan 1
Gx
27
8/3/2022
28
8/3/2022
29
8/3/2022
• Hysteresis Thresholding:
This stage decides which are all edges are really
edges and which are not.
For this, we need two threshold values, minVal
and maxVal.
Any edges with intensity gradient more than
maxVal are sure to be edges and those below
minVal are sure to be non-edges, so discarded.
Those who lie between these two thresholds are
classified edges or non-edges based on their
connectivity. If they are connected to "sure-edge"
pixels, they are considered to be part of edges.
Gradient Value
30
8/3/2022
31
8/3/2022
b0
x m0 m
image space Hough space
32
8/3/2022
y0
x0 x m
image space Hough space
33
8/3/2022
34
8/3/2022
Mapping of
Edge Points in
Edge Detected Image Hough
Parameter
Space
35
8/3/2022
Active Contour
• Active contour model, also called snakes, is a
framework in computer vision for delineating
an object outline from a possibly noisy 2D
image
• The curve formed by the connected edge
points defines the active contour
• It is a set of connected points which
interactively move so as to minimise a
specified energy function
36
8/3/2022
37
8/3/2022
Steps involved
• Prepare the image –
– Define an energy function which could naturally
take on low values for points located on the actual
boundary
– Generate an initial boundary by a segmentation
technique such as thresholding
38
8/3/2022
39
8/3/2022
40
8/3/2022
41