Unit 3 discusses image segmentation techniques. Similarity based techniques group similar image components, like pixels or frames, for compact representation. Common applications include medical imaging, satellite images, and surveillance. Methods include thresholding and k-means clustering. Segmentation of grayscale images is based on discontinuities in pixel values, detecting edges, or similarities using thresholding, region growing, and splitting/merging. Region growing starts with seed pixels and groups neighboring pixels with similar properties. Region splitting starts with the full image and divides non-homogeneous regions, while region merging combines small similar regions.
2. Image Segmentation
Group similar components (such as, pixels in an image,
image frames in a video) to obtain a compact
representation.
ET403:Principles of Image Processing
Applications: Finding tumors, veins, etc. in medical images,
finding targets in satellite/aerial images, finding people in
surveillance images, summarizing video, etc.
Methods: Thresholding, K-means clustering, etc.
3. Image Segmentation
Segmentation algorithms for monochrome images generally
are based on one of two basic properties of gray-scale values:
Discontinuity
The approach is to partition an image based on abrupt changes in
gray-scale levels.
ET403:Principles of Image Processing
gray-scale levels.
The principal areas of interest within this category are detection
of isolated points, lines, and edges in an image.
Similarity
The principal approaches in this category are based on
thresholding, region growing, and region splitting/merging.
4. Thresholding
Suppose that an image, f(x,y), is composed of light objects on a
dark background, and the following figure is the histogram of the
image.
image with dark background
ET403:Principles of Image Processing
Then, the objects can be extracted by comparing pixel values
with a threshold T.
image with dark background
and a light object
5. Thresholding
One way to extract the objects from the background is to select
a threshold T that separates object from background.
Any point (x,y) for which f(x,y) > T is called an object point;
otherwise the point is called a background point.
ET403:Principles of Image Processing
When T is a constant applicable over an entire image, then the
above process is called as Global thresholding.
1 ( , )
( , )
0 ( , )
if f x y T
g x y
f f x y T
6. Thresholding
When the value of T changes over an image
Then that process is referred as Variable thresholding.
Sometimes it is also termed as local or regional thresholding.
Where, the value of T at any point (x,y) in an image depends
ET403:Principles of Image Processing
Where, the value of T at any point (x,y) in an image depends
on properties of a neighborhood of (x,y).
If T depends on the spatial coordinates (x,y) themselves, then
variable thresholding is often referred to as dynamic or
adaptive thresholding.
9. Multilevel Thresholding
It is also possible to extract objects that have a specific intensity
range using multiple thresholds.
image with dark background
and two light objects
ET403:Principles of Image Processing
Extension to color images is straightforward: There are three color channels, in
each one specify the intensity range of the object… Even if objects are not
separated in a single channel, they might be with all the channels… Application
example: Detecting/Tracking faces based on skin color…
10. Multilevel thresholding
• A point (x,y) belongs
– to an object class if T1 < f(x,y) T2
– to another object class if f(x,y) > T2
ET403:Principles of Image Processing
– to background if f(x,y) T1
2
1 2
1
if ( , )
( , ) if ( , )
if ( , )
a f x y T
g x y b T f x y T
c f x y T
13. Role of Noise in Image Thresholding
ET403:Principles of Image Processing
14. Role of Illumination in Image Thresholding
Non-uniform illumination may change the histogram in a
way that it becomes impossible to segment the image using
a single global threshold.
ET403:Principles of Image Processing
Choosing local threshold values may help.
16. Basic Global Thresholding
Based on visual inspection of histogram
1. Select an initial estimate for T.
2. Segment the image using T. This will produce two groups of pixels: G1
consisting of all pixels with gray level values > T and G2 consisting of
pixels with gray level values T
ET403:Principles of Image Processing
3. Compute the average gray level values 1 and 2 for the pixels in
regions G1 and G2
4. Compute a new threshold value
5. T = 0.5 (1 + 2)
6. Repeat steps 2 through 4 until the difference between the values of T
in successive iterations is smaller than a predefined parameter ΔT.
17. Basic Global Thresholding
Note: the clear
valley of the
histogram and the
segmentation
between object and
background
ET403:Principles of Image Processing
background
Initially T= average intensity of image
T0 = 0
3 iterations
with result T = 125
18. Basic Global Thresholding
1. Works well in situations where there is a reasonably clear
valley between the modes of the histogram related to
objects and background.
2. ΔT is used to control the number of iterations.
ET403:Principles of Image Processing
2. ΔT is used to control the number of iterations.
3. Initial threshold must be chosen greater than the minimum
and less than the maximum intensity level in the image
4. The average intensity of the image is a good initial choice
for T.
19. Basic Adaptive Thresholding
• subdivide original image into small areas.
• utilize a different threshold to segment each
subimages.
• since the threshold used for each pixel
ET403:Principles of Image Processing
• since the threshold used for each pixel
depends on the location of the pixel in terms
of the subimages, this type of thresholding is
adaptive.
23. • This method treats pixel values as probability density functions.
• The goal of this method is to minimize the probability of
misclassifying pixels as either object or background.
• There are two kinds of error:
– mislabeling an object pixel as background, and
Optimal Global and Adaptive Thresholding
ET403:Principles of Image Processing
– mislabeling an object pixel as background, and
– mislabeling a background pixel as object.
24. Optimal Global and Adaptive Thresholding
• Method for estimating thresholds that produce the
minimum average segmentation error.
• Let an image contains only two principal gray
regions.
ET403:Principles of Image Processing
regions.
• Let z represents the gray-level values.
• These can be viewed as random quantities, and the
histogram may be considered an estimate of their
probability density function (PDF), p(z).
25. Optimal Global and Adaptive Thresholding
ET403:Principles of Image Processing
1 1 2 2
1 2
( ) ( ) ( )
1
p z P p z P p z
P P
P1: probability that a random pixel
with value z is an object pixel.
P2: probability that a random pixel
Is a background pixel
27. Minimum error
0
))()(()( 2112
TEPTEPdTdE
Differentiating E(T) with respect to T (using Leibniz’s rule) and
equating the result to 0
ET403:Principles of Image Processing
02112
dTdT
)()( 2211 TpPTpP
find T which makes
if P1 = P2 then
the optimum threshold
is where the curve
p1(z) and p2(z) intersect
28. Gaussian density
Example: use PDF = Gaussian density : p1(z) and p2(z)
2
1
2
1
( )
2
1
1
1
( )
2
z
p z e
ET403:Principles of Image Processing
2
2
2
2
( )
2
2
2
1
( )
2
z
p z e
where
• 1 and 1
2 are the mean and variance of the Gaussian density
of one object
• 2 and 2
2 are the mean and variance of the Gaussian density
of the other object
29. Gaussian density
2
1
2
1
2
2
( )
2
1
1
( )
1
( )
2
1
T
T
p T e
ET403:Principles of Image Processing
)()( 2211 TpPTpP
2
2
2
( )
2
2
2
1
( )
2
T
p T e
32. Region-Based Segmentation
• Basic Formulation
, ..., n,iRb
RRa
i
i
n
21region,connectedais)(
)(
1i
ET403:Principles of Image Processing
jfor iFALSE)RP(Re
, ..., n,iTRUE)P(Rd
jiRRc
ji
i
ji
i
)(
21for)(
j,andiallfor)(
P(Ri) is a logical predicate property defined over the points in set Ri
ex. P(Ri) = TRUE if all pixel in Ri have the same gray level
33. Region-Based Segmentation
Region Growing
Region growing is a procedure that groups pixels or
subregions into larger regions.
The simplest of these approaches is pixel aggregation,
which starts with a set of “seed” points and from these
grows regions by appending to each seed points those
ET403:Principles of Image Processing
grows regions by appending to each seed points those
neighboring pixels that have similar properties (such as
gray level, texture, color, shape).
Region growing based techniques are better than the
edge-based techniques in noisy images where edges are
difficult to detect.
34. Region-Based Segmentation
Region Growing
Region growing is a procedure that groups pixels or
subregions into larger regions.
The simplest of these approaches is pixel aggregation,
which starts with a set of “seed” points and from these
grows regions by appending to each seed points those
ET403:Principles of Image Processing
grows regions by appending to each seed points those
neighboring pixels that have similar properties (such as
gray level, texture, color, shape).
Region growing based techniques are better than the
edge-based techniques in noisy images where edges are
difficult to detect.
35. Region Growing
select all seed points with gray level 255
criteria:
1. the absolute gray-
level difference
between any pixel
and the seed has to
be less than 65
2. the pixel has to be 8-
connected to at least
ET403:Principles of Image Processing
connected to at least
one pixel in that
region (if more, the
regions are merged)
36. Region Growing
select all seed points with gray level 255
criteria:
1. the absolute gray-level
difference between any pixel
and the seed has to be less
than 65
ET403:Principles of Image Processing
than 65
2. the pixel has to be 8-
connected to at least one
pixel in that region (if more,
the regions are merged)
37. Histogram of fig 10.40 a)
ET403:Principles of Image Processing
used to find the criteria of the
difference gray-level between
each pixels and the seeds
40. Region-Based Segmentation
Region Splitting
Region growing starts from a set of seed points.
An alternative is to start with the whole image as a single region
and subdivide the regions that do not satisfy a condition of
homogeneity.
ET403:Principles of Image Processing
Region Merging
Region merging is the opposite of region splitting.
Start with small regions (e.g. 2x2 or 4x4 regions) and merge the
regions that have similar characteristics (such as gray level,
variance).
Typically, splitting and merging approaches are used iteratively.
41. Region splitting and merging
ET403:Principles of Image Processing
Quadtree
1. Split into 4 disjoint quadrants any region Ri for which
P(Ri) = FALSE
2. Merge any adjacent region Rj and Rk for which
P(Ri Rk ) = TRUE
3. Stop when no further merging or splitting is possible.
42. Example
ET403:Principles of Image Processing
P(Ri) = TRUE if at least 80% of the pixels in Ri have the property |zj-mi| 2i,
where
zj is the gray level of the jth pixel in Ri
mi is the mean gray level of that region
i is the standard deviation of the gray levels in Ri
43. Example: Apply the split and merge technique to segment
the image shown in fig. below.
ET403:Principles of Image Processing
Figure: Image
R1 R2
R4R3
R1 R2