Chapter 4 DSIP
Chapter 4 DSIP
com
Chapter 10
Image Segmentation
Chapter 10
Image Segmentation
Image Segmentation
Discontinuity Similarity
e.g. e.g.
- Point Detection - Thresholding
- Line Detection - Region Growing
- Edge Detection - Region splitting &
merging
Detection of Discontinuities
Detection of Discontinuities
Point Detection
R T
where T : a nonnegativ e threshold
Detection of Discontinuities
Line Detection
Detection of Discontinuities
Line Detection
Detection of Discontinuities
Edge Detection
Detection of Discontinuities
Edge Detection
Detection of Discontinuities
Edge Detection
Detection of Discontinuities
Edge Detection
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:
x
G f
x
f f
y y
G
– The magnitude of this vector: f mag(f ) G G 2
x
2
y
1
2
Gx
– The direction of this vector: ( x, y ) tan
1
Gy
Detection of Discontinuities
Gradient Operators
Prewitt operators
Sobel operators
Detection of Discontinuities
Gradient Operators
Detection of Discontinuities
Gradient Operators: Example
f G x G y
Detection of Discontinuities
Gradient Operators: Example
Detection of Discontinuities
Gradient Operators: Example
Detection of Discontinuities
Gradient Operators
x y
– Two forms in practice:
Detection of Discontinuities
Gradient Operators
Detection of Discontinuities
Gradient Operators
Detection of Discontinuities
Gradient Operators: Example
Sobel gradient
Detection of Discontinuities
Gradient Operators: Example
In this example,
we can find the
license plate
candidate after
edge linking
process.
Effects of Noise
Laplacian of Gaussian
operator
Solution:
Lets think about equation of line that is y=ax+b.
Now, if we rewrite the same line equation by keeping b in LHS, then we
get b=-ax+y. So if we write the same equation for point A(1,4), then
consider x=1 and y=4 so that we will get b=-a+4. The following table
shows all the equations for a given point
Point equations Now a=0 New point (a,b) Now a=1 New point (a,b)
We can see that almost all line crosses each other at a point (-1,5). So
here now a=-1 and b =5.
Now let’s put these values in the y=ax+b equation so we get y=-1x+5
so y=-x+5 is the line equation that will link all the edges.
[Link]
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. [Link]
For the given image use Hough Transform to form the edge.
Solution:
Thresholding
Thresholding
The Role of Illumination
Thresholding
The Role of Illumination
r ( x, y ) (a) (c) i ( x, y )
(d) (e)
f ( x, y) i( x, y )r ( x, y)
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. [Link]
Thresholding
Basic Global Thresholding
Thresholding
Basic Global Thresholding
Thresholding
Basic Adaptive Thresholding
Thresholding
Basic Adaptive Thresholding
Thresholding
Basic Adaptive Thresholding
Answer: subdivision
Thresholding
Optimal Global and Adaptive Thresholding
Thresholding
Use of Boundary Characteristics
Thresholding
Thresholds Based on Several Variables
Color image
Region-Based Segmentation
Region-Based Segmentation
Basic Formulation
Region Growing
1. Region growing is a procedure that groups pixels or
subregions into larger regions.
2. 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 neighboring
pixels that have similar properties (such as gray level,
texture, color, shape).
3. Region growing based techniques are better than the edge-
based techniques in noisy images where edges are difficult to
detect.
Region Growing
Threshold=10 10 10 10 10 10 10 10
10 10 10 69 70 10 10
59 10 60 64 59 56 60
10 59 10 60 70 10 62
10 60 59 65 67 10 65
10 10 10 10 10 10 10
10 10 10 10 10 10 10
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
10 10 10 69 70 10 10 10 10 10 69 70 10 10 10 10 10 69 70 10 10
59 10 60 64 59 56 60 59 10 60 64 59 56 60 59 10 60 64 59 56 60
10 59 10 60 70 10 62 10 59 10 60 70 10 62 10 59 10 60 70 10 62
10 60 59 65 67 10 65 10 60 59 65 67 10 65 10 60 59 65 67 10 65
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
10 10 10 69 70 10 10 10 10 10 69 70 10 10 10 10 10 69 70 10 10
59 10 60 64 59 56 60 59 10 60 64 59 56 60 59 10 60 64 59 56 60
10 59 10 60 70 10 62 10 59 10 60 70 10 62 10 59 10 60 70 10 62
10 60 59 65 67 10 65 10 60 59 65 67 10 65 10 60 59 65 67 10 65
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
Region-Based Segmentation
Region Growing
Region-Based Segmentation
Region Growing
Region-Based Segmentation
Region Splitting and Merging
Region-Based Segmentation
Region Splitting
Threshold<=3
• The region merging method is exactly opposite to the region splitting method.
• In this method, the pixel level and consider each of them as a homogenous region.
• At any level of merging, check if the four adjacent homogenous regions arranged in
a 2 x 2 fashion together satisfy the homogeneity property.
• If yes, they are merged to form a bigger region, otherwise the regions are left as
they are.
• max - min ≤ 3
Region-Based Segmentation
Region Splitting and Merging
4-directional 8-directional
© 2002 R. C. Gonzalez & R. E. Woods
chain code chain code
Digital Image Processing, 2nd ed. [Link]
4-directional 8-directional
chain code chain code
First Difference
Problem of a chain code: a chain code sequence depends on a starting point.
Solution: treat a chain code as a circular sequence and redefine the starting point so that the
resulting sequence of numbers forms an integer of minimum magnitude.
The first difference of a chain code: counting the number of direction change (in
counterclockwise) between 2 adjacent elements of the code.
Shape Number
1
Shape number of the boundary definition:
the first difference of smallest magnitude
2 0
The order n of the shape number:
the number of digits in the sequence
3
Signature
Image Moments
Here, x, y refers to the row and column index and I(x,y) refers
to the intensity at that location (x,y).
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. [Link]
Area:
For a binary image, the zeroth order moment corresponds to the
area. Using the above formulae, the zeroth order moment (M00)
is given by
Centroid:
Centroid simply is the arithmetic mean position of all the points.
In terms of image moments, centroid is given by the relation