LNT Seminar Image Segmentation Ver2
LNT Seminar Image Segmentation Ver2
Segmentation Techniques
Performance Evaluation
Color Image Segmentation
Conclusion
Image Segmentation
Subrajeet Mohapatra
Image Processing and Computer Vision Laboratory
Department of Electrical Engineering
National Institute of Technology Rourkela
Table of Contents
1 Introduction
Digital Image Processing
What is Image Segmentation?
Problem Definition
Methodology
2 Segmentation Techniques
Discontinuity Based Segmentation
Point and Line Detection
Edge Detection
Similarity Based Segmentation
Thresholding Based Segmentation
Region Based Segmentation
Clustering Based Segmentation
3 Performance Evaluation
4 Color Image Segmentation
5 Conclusion
An image is a 2D function, I = f (x , y )
where x and y are spatial coordinates
Amplitude of f at any pair of coordinates (x , y ) is called the
intensity (I) or gray level of the image.
Definition
Image Segmentation is the partitioning of an image into
meaningful regions that have strong correlation with objects
or areas of the real world contained in the image.
Definition
Image Segmentation is a procedure that describes the process
of dividing an image into non overlapping, connected image
areas, called regions, on the basis of criteria governing
similarity and homogeneity.
Segmentation Examples
Segmentation Examples
Problem Definition
Problem Definition
Methodology
Image segmentation algorithms are developed based on
two basic properties of intensity values:
Discontinuity
Similarity
In discontinuity based approach the partition is carried out
based on some abrupt changes in gray level intensity of
the image.
Similarity based approach is based on grouping of pixels
based on some features.
Methods of Segmentation
Discontinuity based
Detection of Isolated Points
Detection of Lines
Edge Detection
Similarity based
Thresholding
Region growing
Region Splitting and Merging
Clustering
K–Means Clustering
Fuzzy C Means Clustering
Measuring Discontinuity
Measuring Discontinuity
The sum of products of the mask coefficients with the
corresponding image gray values is computed for each
pixel.
Measuring Discontinuity
9
R = w1 f1 + w2 f2 + w3 f3 + · · · + w9 f9 = wi fi
i =1
|R | > T
Points are detected at those pixels in the subsequent
filtered image above this threshold.
A 3 × 3 point detection mask can be represented as:
(a) X-ray Image (b) Result point detection (c) Result Thresholding
:
18/118 Subrajeet Mohapatra Image Segmentation
Introduction
Segmentation Techniques
Discontinuity Based Segmentation
Performance Evaluation
Similarity Based Segmentation
Color Image Segmentation
Conclusion
(a) Horizontal (b) +45 degree (c) Vertical (d) –45 degree
(a) Wire Bond Image (b) Line detection (c) Result Thresholding
Edge Detection
Derivatives
∂f
= f (x + 1) − f (x )
∂x
Second derivative about a point x can be expressed as
∂2 f
= f (x + 1) + f (x − 1) − 2f (x )
∂x 2
90
85
80
75
70
65
60
55
50
0 2 4 6 8 10 12 14 16
(a) Intensity
40
40
30
30
20
20
10
10
0
0
−10
−10
−20
−20
−30 −30
−40 −40
0 5 10 15 0 2 4 6 8 10 12 14
:
25/118 Subrajeet Mohapatra Image Segmentation
Introduction
Segmentation Techniques
Discontinuity Based Segmentation
Performance Evaluation
Similarity Based Segmentation
Color Image Segmentation
Conclusion
Gradient Operator
f)
∇f = mag (∇
1
= [Gx2 + Gy2 ] 2
≈ |Gx | + |Gy |
29/118 Subrajeet Mohapatra Image Segmentation
Introduction
Segmentation Techniques
Discontinuity Based Segmentation
Performance Evaluation
Similarity Based Segmentation
Color Image Segmentation
Conclusion
Gradient Operator
f is
Direction of ∇
−1 Gy
α(x , y ) = tan (1)
Gx
f.
α(x , y ) provides the direction of ∇
f.
Edge direction is perpendicular to the direction of ∇
Prewitt Operator
Prewitt operator is a discrete differentiation operator, which
computes the gradient of the image intensity at each point
along with its orientation.
Two 3 × 3 kernels are convolved with the image to obtain
the derivatives for horizontal and vertical changes.
:
32/118 Subrajeet Mohapatra Image Segmentation
Introduction
Segmentation Techniques
Discontinuity Based Segmentation
Performance Evaluation
Similarity Based Segmentation
Color Image Segmentation
Conclusion
Sobel Operator
Sobel operator calculates the gradient of the image
intensity at each point.
Sobel operator uses two 3 × 3 kernels are convolved with
the image to obtain the derivatives for horizontal and
vertical changes.
Laplacian Operator
Laplacian is the second derivative
Laplacian operator of f (x , y ) is
∂2 f ∂2 f
∇2 f =
+
∂x 2 ∂y 2
Mask implementing second derivative operator is given as
Edge Linking
Thresholding
Thresholding Example
Image Histogram
Image histogram describes the frequency of the intensity
values that occur in an image.
Histogram can be very efficiently used for determining the
threshold for image segmentation.
1000
900
800
700
600
Pixel Count
500
400
300
200
100
Bimodal Histogram
Bimodal Histogram
Bi–level Thresholding
Multimodal Histogram
Multimodal Histogram
Multimodal Thresholding
Images with multimodal histogram requires multiple
thresholds for partitioning an image into different
segments.
Thresholding for a Multimodal Histogram can be
mathematically represented as
f(x, y) ≤ T2 ⇒ (x, y) ∈ R1
Thresholding Selection
where,
(x,y) ⇒ Pixel Location
p(x,y) ⇒ Local property in a neighborhood centered at
(x , y ).
f(x,y) ⇒ Pixel intensity at (x , y ).
53/118 Subrajeet Mohapatra Image Segmentation
Introduction
Segmentation Techniques
Discontinuity Based Segmentation
Performance Evaluation
Similarity Based Segmentation
Color Image Segmentation
Conclusion
Thresholding Selection
Thresholding Selection
Thresholded Image
Threshold Estimation
3500
3000
2500
2000
1500
1000
500
Automatic Thresholding
Automatic Thresholding
Algorithm
1 Select an initial value of threshold T .
Automatic Thresholding
Algorithm
1 Select an initial value of threshold T .
Automatic Thresholding
Algorithm
1 Select an initial value of threshold T .
Automatic Thresholding
Algorithm
1 Select an initial value of threshold T .
Automatic Thresholding
Algorithm
1 Select an initial value of threshold T .
Ti − Ti +1 ≤ Th
61/118 Subrajeet Mohapatra Image Segmentation
Introduction
Segmentation Techniques
Discontinuity Based Segmentation
Performance Evaluation
Similarity Based Segmentation
Color Image Segmentation
Conclusion
Global Threshold
3000
2500
2000
1500
1000
500
Global Threshold
Optimal Thresholding
Optimal Thresholding
Optimal Thresholding
Optimal Thresholding
Optimal Thresholding
Overall histogram p (z ) can be represented by the
combination of p1 (z ) and p2 (z ).
p (z ) can be mathematically denoted as,
p (z ) = P1 p1 (z ) + P2 p2 (z )
where,
P1 indicates the probability that a pixel will belong to the
background.
P2 indicates the probability that a pixel will belong to the
object.
Sum of both the probabilities will be unity.
P1 + P2 = 1
72/118 Subrajeet Mohapatra Image Segmentation
Introduction
Segmentation Techniques
Discontinuity Based Segmentation
Performance Evaluation
Similarity Based Segmentation
Color Image Segmentation
Conclusion
Optimal Thresholding
Optimal Thresholding
f (x , y ) > T ⇒ Object
Pixels beyond T with intensity f (x , y ) also have a finite
probability that it may belong to the background.
Optimal Thresholding
Optimal Thresholding
E (T ) = P2 E1 (T ) + P1 E2 (T )
For minimizing this error we will take derivative of E (t ) and
equate to zero.
∂E (T )
=0
∂T
Under this condition what ever T we get will give us
minimum error.
P1 p1 (T ) = P2 p2 (T )
Optimal Thresholding
(μ1 + μ2 ) σ2 P2
T= + ln( )
2 μ1 − μ2 P1
Local Thresholding
Threshold selection is easier if the image histogram is:
Bimodal and modes are tall, narrow and separated by a
deep valley.
If the modes are symmetric.
Local Thresholding
Considering an image where a very small number of pixels
represent a object and large number of pixels represent
the back ground.
Local Thresholding
Local Thresholding
Local Thresholding
Advantages
Thus the histogram will be symmetric.
Histogram will be independent of relative size of object and
background region.
The probability of a pixel belonging to object and the
probability of a pixel belonging to background within the
narrow strip is almost same.
Thresholding such an histogram will be easier.
Local Thresholding
Local Thresholding
Local Thresholding
Local Thresholding
Using f (x , y ), |∇f |, |∇2 f | an intermediate segmented image
can be obtained
⎧
⎪
⎪ 0 if ∇f < T
⎪
⎨
s (x , y ) = ⎪
⎪ + if ∇f ≥ T and∇2f ≥ 0
⎪
⎩ − if ∇f ≥ T and∇2f < 0
Local Thresholding
Local Thresholding
Region Definition
Region Definition
Region Growing
It is a procedure which groups the pixels or subregions into
larger region based on a defined predicate.
After selecting a set of points (seed) in the image, the
operation tries to grow the region staring from the seed
point incorporating all the points similar to the seed point.
Two points can be said similar if there intensity values are
very close.
Homogeneity Measure
1 2
MH (R ) = f (x , y ) − f̄ (x , y ) ≤ T
|R |
(x ,y )∈R
Homogeneity Measure
max − min ≤ T
g(r ,c )∈R g(r ,c )∈R
Region Splitting
Quad Tree
Region Merging
K- means clustering
K-Means algorithm is an unsupervised clustering algorithm
that classifies the input data points into multiple classes
based on their inherent distance from each other.
Algorithm:
1 Assign initial means vi (centroid)
2 Assign each data pattern (point) Xk to the cluster Ui for the
closest mean.
3 New updated centroid
X k ∈ Ui Xk
vi = ,
| Ci |
4 Repeat step 2 and 3 until the updated centroid become
stable.
106/118 Subrajeet Mohapatra Image Segmentation
Introduction
Segmentation Techniques
Discontinuity Based Segmentation
Performance Evaluation
Similarity Based Segmentation
Color Image Segmentation
Conclusion
Subjective Evaluation
Subjective Evaluation
(a) Cell 1 (b) Ground Truth (c) Cell 2 (d) Ground Truth
Figure:
Objective Evaluation
Conclusion
Important References I
1 Anil K. Jain.
Fundamentals of Digital Image Processing.
Prentice-Hall of India, 1989.