7
7
These slides should not be used as the primary source of data. Students are encouraged to learn from the core textbooks and reference books. Contents in these slides are copyrighted to the instructor and authors of
original texts where applicable. -Mohan Bhandari
Image Segmentation
Chapter 6
These slides should not be used as the primary source of data. Students are encouraged to learn from the core textbooks and reference books. Contents in these slides are copyrighted to the instructor and authors of
original texts where applicable. -Mohan Bhandari
REFERENCES
T1
Thresholding
Thresholding
Problems With Single Value Thresholding
Segmentation
Edge detection and Thresholding
not always effective.
Homogenous regions
Region-based segmentation.
Effective in noisy images.
Definations
Based on sets.
Each image R is a set of R7
R6
regions Ri.
Every pixel belongs to one R1
R5
region.
One pixel can only belong to a R2 R3
single region. R4
S
R i=1
= Ri Ri intersect R j =∅
Definations
R7
R6
R1
R5
R2 R3
R4
Basic Formulation
a) n R i=R
i=1 a) Every pixel must be in a region
Groups pixels into larger
Iterative process
regions. How to start?
Starts with a seed region. How to iterate?
Grows region by merging
When to stop?
neighboring pixels.
Finish
Initial Stop
Iterations
Regions Condition
Region Growing
Region Merging
Algorithm
Divide image into an initial set of regions.
One region per pixel.
Define a similarity criteria for merging regions.
Merge similar regions.
Repeat previous step until no more merge operations are
possible.
Similarity Criteria
Homogeneity of regions is used as the main
segmentation criterion in region growing.
gray level
color, texture
shape Choice of criteria affects
segmentation results
model dramatically!
etc.
Gray-Level Criteria
Comparing to Original Seed Pixel
Very sensitive to choice of seed point.
Comparing to Neighbor in Region
Allows gradual changes in the region.
Can cause significant drift.
Comparing to Region Statistics
Acts as a drift dampener.
Other possibilities!
Region Splitting
Algorithm
R1 R2
One initial set that includes the R1
whole image. R3 R4
Similarity criteria.
Iteratively split regions into
sub-regions.
Stop when no more splittings R1 R2
R1 R2 R3
are possible.
R4 R5
R3
R4 R5 R6 R7 R6 R7
Splitting and Merge
Combination of both
algorithms.
Can handle a larger variety of
shapes.
Simply apply previous
algorithms consecutively.
Detection Of Discontinuities
There are three basic types of grey level discontinuities that
we tend to look for in digital images:
– Points
– Lines
– Edges
We typically find discontinuities using masks and correlation
Detection Of Discontinuities
Detection Of Discontinuities
Point Detection
Point detection can be achieved simply using the mask
below:
After processing
Result of
with -45° line
thresholding
detector
filtering result
Edge
These slides should not be used as the primary source of data. Students are encouraged to learn from the core textbooks and reference books. Contents in these slides are copyrighted to the instructor and authors of
original texts where applicable. -Mohan Bhandari
depth discontinuity
illumination discontinuity
Step Edges
– Edge Magnitude
– Edge Orientation
– High Detection Rate and Good Localization
Edge Detection
These slides should not be used as the primary source of data. Students are encouraged to learn from the core textbooks and reference books. Contents in these slides are copyrighted to the instructor and authors of
original texts where applicable. -Mohan Bhandari
First-order derivatives generally produce thicker edges in image
Second-order derivatives have a stronger response to fine detail,
such as thin lines, isolated points, and noise
Gradient
• Gradient equation:
• Gradient direction:
∂I I i , j+1 I i+1 , j +1
≈ ( ( I i +1 , j+1 − I i , j+ 1) + ( I i+ 1, j − I i , j ) )
∂x
∂I Ii, j I i+1 , j
≈ ( ( I i+1 , j +1 − I i +1 , j ) + ( I i , j +1 − I i , j ) )
∂y
Convolution masks :
∂I −1 1 ∂I 1 1
∂x −1 1 ∂y −1 −1
Discrete Edge Operator
• Second order partial derivatives: I i− 1 , j+1 I i , j+1 I i+1 , j +1
∂2 I I i− 1 , j Ii, j I i+1 , j
2
≈ ( I i , j −1 −2 I i , j + I i , j+1 )
∂y
∂2 I I i− 1 , j −1 I i , j −1 I i+1 , j −1
2
≈ ( I i −1 , j − 2 I i , j + I i +1 , j )
∂x
• Laplacian :
2 ∂2 I ∂2 I
∇ I= 2
+ 2
∂x ∂ y
Convolution masks :
0 1 0 1 4 1
2
∇ I≈
1 −4 1 4 −20 4
0 1 0 1 4 1
Image Edge Detection Operators in Digital Image Processing
It uses two 3 x 3 kernels or masks which are convolved with the input
image to calculate the vertical and horizontal derivative approximations
respectively
Sobel Operator
These slides should not be used as the primary source of data. Students are encouraged to learn from the core textbooks and reference books. Contents in these slides are copyrighted to the instructor and authors of
original texts where applicable. -Mohan Bhandari
Advantages:
Simple and time efficient computation
Very easy at searching for smooth edges
Limitations:
Diagonal direction points are not preserved always
Highly sensitive to noise
Not very accurate in edge detection
Detect with thick and rough edges does not give appropriate results
Prewitt Operator
These slides should not be used as the primary source of data. Students are encouraged to learn from the core textbooks and reference books. Contents in these slides are copyrighted to the instructor and authors of
original texts where applicable. -Mohan Bhandari
This operator is almost similar to the sobel operator.
It also detects vertical and horizontal edges of an image.
It is one of the best ways to detect the orientation and magnitude of an
image. It uses the kernels or masks
Prewitt Operator
These slides should not be used as the primary source of data. Students are encouraged to learn from the core textbooks and reference books. Contents in these slides are copyrighted to the instructor and authors of
original texts where applicable. -Mohan Bhandari
Advantages:
Good performance on detecting vertical and horizontal edges
Best operator to detect the orientation of an image
Limitations:
The magnitude of coefficient is fixed and cannot be changed
Diagonal direction points are not preserved always
Robert Operator
These slides should not be used as the primary source of data. Students are encouraged to learn from the core textbooks and reference books. Contents in these slides are copyrighted to the instructor and authors of
original texts where applicable. -Mohan Bhandari
Advantages
Detection of edges and orientation are very easy
Diagonal direction points are preserved
Limitations
Very sensitive to noise
Not very accurate in edge detection
Comparision of Operators
Good Localization
Gradient:
Noise Sensitive
Poor Detection
Roberts (2 x 2): 0 1 1 0
-1 0 0 -1
Sobel (3 x 3):
-1 0 1 1 1 1
-1 0 1 0 0 0
-1 0 1 -1 -1 1
Sobel (5 x 5):
-1 -2 0 2 1 1 2 3 2 1
-2 -3 0 3 2 2 3 5 3 2
Poor Localization
-3 -5 0 5 3 0 0 0 0 0
Less Noise Sensitive
-2 -3 0 3 2 -2 -3 -5 -3 -2 Good Detection
-1 -2 0 2 1 -1 -2 -3 -2 -1
Edge Detection Example
Laplace Operator
Works by smoothing the image with a Gaussian low-pass
filter, and then applying a Laplacian edge detector to the
result.
The LoG filter can sometimes be approximated by taking
the differences of two Gaussians of different widths, in a
method known as Difference of Gaussians (DoG).
Laplacian of Gaussian
Laplacian318
of Gaussian (LoG) transfer function (Mexican hat)
EDGE DETECTION
(a) (b)
Effect of Noise
• Consider a single row or column of the image
– Plotting intensity as a function of position gives a signal
Advantages:
Easy to detect edges and their various orientations
There is fixed characteristics in all directions
Limitations:
Very sensitive to noise
The localization error may be severe at curved edges
It generates noisy responses that do not correspond to edges, so-called “false edges”
Difference of Gaussian
Canny edge detector have advanced algorithm derived from the previous work of
Laplacian of Gaussian operator. It is widely used as an optimal edge detection technique.
It detects edges based on three criteria:
Low error rate
Edge points must be accurately localized
There should be just one single edge response
Canny Edge Operator
Let (x,y) be the coordinates of a point in a binary image (containing threshold edge detection
results).
The Hough transform stores in an accumulator array all pairs (a,b) that satisfy the equation
y = ax+ b. The (a,b) array is called the transform array.
Example:, the point (x,y) = (1,3) in the input image will result in the equation b = -a + 3, which can be plotted
as a line that represents all pairs (a,b) that satisfy this equation.
Hough Transform
Since each point in the image will map to a line in the transform domain, repeating the process for other
points will result in many intersecting lines, one per point.
The meaning of two or more lines intersecting in the transform domain is that the points to which they
correspond are aligned in the image.
The points with the greatest number of intersections in the transform domain correspond to the longest
lines in the image.
Hough Transform