03 - Image Segmentation
03 - Image Segmentation
Image Segmentation
by:
Hossam El Din Hassan Abd El Munim
حسام الدين حسن عبد المنعم
Computer & Systems Engineering Dept.,
Ain Shams University,
1 El-Sarayat Street, Abbassia, Cairo 11517
1
Image Segmentation
The process of image segmentation/classification aims to partition the
image into regions of interest.
2
Image Segmentation Challenges
• Noise
• Inhomogeneities
• Cluttered/Occluded/Overlapped Objects
3
Segmentation Approaches
1. Boundary-Based
2. Region-Based
• Deformable templates
• Statistical/clustering techniques
4
Thresholding
5
Multilevel thresholding
• a point (x,y) belongs to
– to an object_1 class if f(x,y) T1
– to another object_2 class if T2 ≥ f(x,y) > T1
– to background if f(x,y) > T2
• T depends on
– only f(x,y) : only on gray-level values Global threshold
– both f(x,y) and p(x,y) : on gray-level values and its
neighbors Local threshold
6
Example 1
7
Example 2
Bone and Non-Bone Tissues
8
Basic Global Thresholding
Algorithm
Based on visual inspection of histogram
ϵ0 = 0
3 iterations
with result T = 125
10
Example: Limitation (T=104.3327)
11
The Role of Illumination: Another
Limitation
easily use global thresholding
object and background are separated
13
Example : Adaptive Thresholding
14
Example: Global Thresholding
(T=157.5487)
15
Example: Adaptive Thresholding
10X10 Blocks
16
Optimal Global and Adaptive Thresholding
Object/Background Case
p( z ) P1 p1 ( z ) P2 p2 ( z )
P1 P2 1
P1 and P2 are called Prior Probabilities and p(z) is the
normalized histogram function 17
Segmentation/Classification Decision
if P1 p1 ( z ) P2 p2 ( z )
18
Total Segmentation Error
T
E1 (T )
p 2 ( z ) dz
E2 (T ) p1 ( z )dz
T
E (T ) P2 E1 (T ) P1 E2 (T )
19
Minimum Error
dE(T ) d ( P2 E1 (T ) P1 E2 (T ))
0
dT dT if P = P then 1 2
the optimum threshold
is where the curve
find T which makes p1(z) and p2(z) intersect
P1 p1 (T ) P2 p2 (T )
20
Gaussian Density
p( z ) P1 p1 ( z ) P2 p2 ( z )
( z 1 ) 2 ( z 2 )2
P1 2 12 P2 2 22
e e
where 2 1 2 2
• 1 and 12 are the mean and variance of the Gaussian
density of the object
• 2 and 22 are the mean and variance of the Gaussian
density of the background 21
Solution: Quadratic Equation
B B 4 AC
2
T
2A
22
Solution: Quadratic Equation
Equal Variances
23
Solution: Quadratic Equation
Equal Variances and Equal Priors
24
Example: Lung Segmentation from
CT Images
25
Example: Object Parameters
Estimation (Mean=40, Variance=4.4)
26
Example: Background Parameters
Estimation (Mean=223, Variance=8)
27
Example: Segmentation Results
P1=P2=0.5
28
Example: Isolate Lungs by flood-fill
Algorithm
29
Segmentation/Classification Decision of
Color Images
Segmentation/Classification Decision of
Color Images(Same Rules but Feature
Vector )
if P1 p1 ( z ) P2 p2 ( z )
Pixel is Classified as Object
Else
Pixel is Classified as Background
z [ R G B] T
31
Gaussian Density: Multivariate
32
Computation Issues
Instead of
33
Gaussian Density: Multivariate
Parameters Estimation
•Given n pixels with color vectors X1, X2, …,Xn: the mean vector
and covariance matrix can be estimated as follows:-
34
Example1: Object parameters Estimation
Example1: Background parameters
Estimation
Example1: Results
Example1: Results-Object Boundary
Example2: Object/Background parameters
Estimation
Example2: Results
Example2: Results-Object Boundary
Example3: Object/Background parameters
Estimation
Example3: Results
Example3: Results-Object Boundary
Sources of Error