# Image Segmentation Lecture 17 _page 1_ 10.3 Thresholding 10.3.1

Document Sample

```					Image Segmentation                      Lecture 17 (page 1)

10.3 Thresholding

10.3.1 Foundation

Segmentation problems requiring multiple thresholds are best
solved using region growing methods

Thresholding can be viewed as

T = T [ x, y, p(x, y), f (x, y) ],

where f (x, y) is gray-level at (x, y) and p(x, y) denotes some
local property, for example average gray level in neighbourhood
Image Segmentation                      Lecture 17 (page 2)

A thresholded image g(x, y) is deﬁned as



   1, f (x, y) > T
g(x, y) =                     ,

    0, f (x, y) < T

where 1 is object and 0 is background

When T = T [ f (x, y) ], threshold is global

When T = T [ p(x, y), f (x, y) ], threshold is local

When T = T [ x, y, p(x, y), f (x, y) ], threshold is dynamic

10.3.2 The Role of Illumination

Again consider the model f (x, y) = i(x, y) r(x, y)

In general, when only the reﬂectance component is present,
the modes in the histogram can be more easily separated

When the illumination component is present separation be-
comes much more diﬃcult...
Image Segmentation                     Lecture 17 (page 3)

Explanation

z(x, y) =   ln f (x, y)
=   ln [ i(x, y) r(x, y) ]
=   ln i(x, y) + ln r(x, y)
=   i 0(x, y) + r 0(x, y)
Image Segmentation                         Lecture 17 (page 4)

Since i 0 is independent of r 0, we know from probability theory
that
hist (z) = hist (i 0) ∗ hist (r 0)

Note that when
i(x, y) ≡ constant,
then
i 0(x, y) = ln i(x, y) ≡ constant
and
hist (i 0) ≡ impulse
so that
hist (z) = hist (i 0) ∗ hist (r 0) ≈ hist (r 0)

Therefore, when the illumination is uniform, the histogram is
not substantially eﬀected

With non-uniform illumination though,
hist (i 0) ≡ pulse,
which results in hist (z) being smoothed or smeared
Image Segmentation                    Lecture 17 (page 5)

Photograph any object with uniform reﬂectance
g(x, y) = k i(x, y)
and let
f (x, y) r(x, y)
h(x, y) =           =
g(x, y)    k
so that
r(x, y) = k h(x, y)

Thus, if r(x, y) can be segmented by using a single threshold
T , then h(x, y) can be segmented by using a single threshold
of value T /k

10.3.3 Basic Global Thresholding

(1) Heuristic approach based on visual inspection of histogram

(2) Algorithm used to obtain T automatically
Image Segmentation                     Lecture 17 (page 6)

Visual inspection of histogram

Algorithm used to obtain T automatically

(1) Select an initial estimate for T
Group G1 (values > T )
(2) Segment image using T −→
Group G2 (values < T )
(3) Compute average gray level values for G1, G2 −→ µ1, µ2
(4) Compute a new threshold value T = 1 (µ1 + µ2)
2
(5) Repeat (2) through (4) until the diﬀerence in T in succes-
sive iterations is smaller than T0
Image Segmentation                   Lecture 17 (page 7)

Example 10.11: Segmentation using estimated global T

˜
Algorithm results in T = 125.4 after 3 iterations, so let T =
125
Image Segmentation                   Lecture 17 (page 8)

• Divide original image into subimages

• Utilize a diﬀerent threshold to segment each subimage

• Diﬃculties: Subdivision and subsequent threshold estimation

Example 10.12:
Image Segmentation                   Lecture 17 (page 9)

• For subimages without boundaries, variance < 75, so when
variance < 100, subimages treated as a single composite image

• For subimages with boundaries, variance > 100, so when
variance > 100, subimages treated separately

• In both these cases T is obtained automatically with T0
midway between the minimum and maximum gray level
Image Segmentation                       Lecture 17 (page 10)

10.3.5 Optimal Global and Adaptive Thresholding
Assume two principal gray level regions...

Mixture PDF describing overall gray level variation...
p(z) = P1 p1(z) + P2 p2(z)
P1: probability that pixel is object pixel
P2: probability that pixel is background pixel
P1 + P2 = 1
Select T that minimizes average error in making decision
Probability in erroneously classifying background as object
Z
T
E1(T ) =   −∞ p2 (z) dz

Probability in erroneously classifying object as background
Z
∞
E2(T ) =       T p1 (z) dz
Image Segmentation                   Lecture 17 (page 11)

Overall probability of error is
E(T ) = P2 E1(T ) + P1 E2(T )

Threshold value for which the error is minimal
P1 p1(T ) = P2 p2(T ) ... (∗∗)

Approximate p1(z) and p2(z) with Gaussian densities...
P1         2   2    P2         2    2
p(z) = √ e−(z−µ1) /2σ1 + √ e−(z−µ2) /2σ2
2π                  2π

Using this equation in (∗∗) results in AT 2 + BT + C = 0,
where
2     2
A = σ1 − σ2
2       2
B = 2 (µ1 σ2 − µ2 σ1 )
2        2        2 2
C = σ1 µ2 − σ2 µ2 + 2 σ1 σ2 ln (σ2 P1/σ1 P2)
2       1

Note that two threshold values are generally required
2    2
Also note that if σ 2 = σ1 = σ2 , one threshold is suﬃcient:
   
µ1 + µ2      σ2        P
 2
T =         +         ln     
2      µ1 − µ2      P1

When P1 = P2 and/or σ = 0 the optimal threshold is the
average of the means
Image Segmentation                   Lecture 17 (page 12)

Alternatively, a minimum mean square approach may be used
to estimate a composite PDF from the image histogram
1 Xn
ems =       [ p(zi) − h(zi) ]2
n i=1

The reason for estimating the complete density is to determine
the presence or absence of dominant modes in the PDF. Two
dominant modes typically indicate the presence of edges in the
image or subimage

Example 10.13: Use of optimal thresholding for image seg-
mentation
Image Segmentation                   Lecture 17 (page 13)

Example of cardioangiogram

(1) Preprocessing
(1.1) s = c log(1 + r)
(1.2) Image subtraction
(1.3) Image averaging (several images) −→ reduce random
noise
(2) Image subdivided into subimages and their histograms cal-
culated
(3) Unimodal histograms rejected and bimodal histograms ﬁt-
ted by bimodal Gaussian density curves
(4) At ﬁrst only those regions with bimodal histograms are
assigned thresholds
(5) Interpolate these thresholds to obtain thresholds for the
other (unimodal) regions
(6) Interpolate again so that every pixel has a threshold
(7) Apply thresholds −→ binary image
(8) Apply gradient operators −→ boundaries
Image Segmentation   Lecture 17 (page 14)
Image Segmentation                     Lecture 17 (page 15)

10.3.6 Use of Boundary Characteristics for Histogram
Improvement and Local Processing
Consider only the edge pixels −→ “better” histograms

Peaks of similar height







Properties of “better” histograms:  Symmetrical




 Deeper valleys


−→ easier to obtain threshold







0 if |∇f | < T

Let s(x, y) =  ⊕ if |∇f | ≥ T and ∇2f ≥ 0



 ª if |∇f | ≥ T and ∇2 f < 0



When we have a dark object on a light background:
Pixels that are not edge pixels: s(x, y) = 0
Pixels on the dark side of the edge: s(x, y) = ⊕
Pixels on the light side of the edge: s(x, y) = ª
A segmented binary image is then generated, where 1 is part
of the object and 0 is part of the background...
(· · ·)(ª, ⊕)     (0 or ⊕) (⊕, ª)(· · ·)
|   {z   }
part of object
Pixels in center bracket −→ 1, rest −→ 0
Image Segmentation   Lecture 17 (page 16)
Image Segmentation                      Lecture 17 (page 17)

10.4 Region-Based Segmentation
Here we ﬁnd the regions directly
10.4.1 Basic formulation
Let R represent the entire image region
The segmentation process partitions R into n subregions, R1,
R2, . . . , Rn, such that...
(a) ∪n Ri = R
i=1

(b) Ri is a connected region, i = 1, 2, . . . , n
(c) Ri ∩ Rj = ∅ for all i and j, i 6= j
(d) P (Ri) = TRUE for i = 1, 2, . . . , n
(e) P (Ri ∪ Rj ) = FALSE for i 6= j
Here P (Ri) is logical predicate deﬁned over all points in Ri
(a) Every pixel must be in a region
(b) All the points in a region must be “connected”
(c) Regions must be disjoint
(d) For example P (Ri) = TRUE if all the pixels in Ri have the
same gray level
(e) Regions Ri and Rj are diﬀerent in some sense
Image Segmentation                    Lecture 17 (page 18)

10.4.2 Region growing
• Start from a set of seed points and from these points
grow the regions by appending to each seed those neighbouring
pixels that have similar properties
• The selection of the seed points depends on the problem.
When a priory information is not available, clustering tech-
niques can be used: compute the above mentioned properties
at every pixel and use the centroids of clusters
• The selection of similarity criteria depends on the problem
under consideration and the type of image data that is available
• Descriptors must be used in conjunction with connectivity
• Formulation of a “stopping rule”. Growing a region should
stop when no more pixels satisfy the criteria for inclusion in
that region.
• When a model of the expected results is partially available,
the consideration of additional criteria like the size of the
region, the likeliness between a candidate pixel and the pixels
grown so far, and the shape of the region can improve the
performance of the algorithm.
Image Segmentation               Lecture 17 (page 19)

Example 10.16: Application of region growing to weld in-
spection
Image Segmentation                   Lecture 17 (page 20)

10.4.3 Region splitting and merging
Subdivide an image initially into a set of arbitrary, disjoint
regions and then merge and/or split the regions in an attempt
to satisfy the necessary conditions
Let R represent entire image region and select a predicate P

(1) Split into four disjoint quadrants any region Ri for which
P (Ri) = FALSE
(2) Merge any adjacent regions Rj and Rk for which
P (Rj ∪ Rk ) = TRUE
(3) Stop when no further merging or splitting is possible

Several variations of this theme are possible
Image Segmentation                 Lecture 17 (page 21)

Example 10.17: Split and merge

Deﬁne P (Ri) = TRUE if at least 80% of the pixels in Ri have
the property |zi − mi| < 2σi

If P (Ri) = TRUE, the value of all the pixels in Ri are set
equal to mi

Splitting and merging are done using the algorithm on the
previous transparency

Properties based on mean and standard deviation attempt to
quantify the texture of a region

Texture segmentation is based on using measures of texture
for the predicates P (Ri)

```
DOCUMENT INFO
Shared By:
Categories:
Stats:
 views: 11 posted: 3/3/2011 language: English pages: 21