Image segmentation
Image segmentation
-1 -1 -1
-1 8 -1
-1 -1 -1
• A point has been detected at the location on which the mask is centered if |R|>T
where T is non negative threshold and.
• The idea is that the gray level of an isolated point will be quite different from
the gray levels of its neighbors.
• The mask operation measures the weighted differences between the centre
point and its neighbors. The differences that are large enough are determined
by T considered isolated points in the image of interest.
Detection of Discontinuities Point
Detection
RT
where T : a nonnegative threshold
Line Detection
• Only slightly more common than point detection is to find a one pixel
wide line in animage.
• For digital images the only three point straight lines are only horizontal,
vertical, or diagonal (+ or–45degree).
• If the horizontal mask is moved around an image it would respond more
strongly to lines oriented horizontally.
• With constant background the maximum response would result when the
line is passing through the middle row of the mask.
Detection of Discontinuities Line Detection
Edge Detection
• Edges characterize object boundaries are therefore useful for
segmentation and identification of objects in scene.
• Edge point can be thought of as pixel location of abrupt gray
levels. It is the boundary between two regions with relatively
distinct gray level properties.
• There are two types of edges step and ramp edge.
• The step edges are detected using first order derivative filters like
Robert, Sobel, Frichen and Prewit.
• The ramp edges can be detected using second order derivative
line Laplacian filter.
Detection of Discontinuities Edge 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: Example
First-order derivatives:
– The gradient of an image f(x,y) at location (x,y)is defined as the
vector:
F
– magnitude of this vector:
The f = mag(f) = G + G 2
x
2
y 1
2
Gx
– The direction of this vector: (x, y) = tan
−1
G
y
– It points in the direction of the greatest rate of change of f at
location (x,y)
Detection of Discontinuities Gradient
Operators: Example
Detection of Discontinuities Gradient
Operators: Example
Roberts cross-gradient operators
Prewitt operators
Sobel operators
Detection of Discontinuities Gradient
Operators: Example
f Gx + G y
Detection of Discontinuities Gradient
Operators: Example
Detection of Discontinuities Gradient
Operators: Example
Detection of Discontinuities Gradient
Operators: Example
Detection of Discontinuities Gradient
Operators
Second-order derivatives: (The Laplacian)
– The Laplacian of an 2D function f(x,y) is defined as
2
f 2
f
2 f = 2 + 2
x y
4
• The Laplacian of a Gaussian (LoG)sometimes is called the
Mexican hat function. Italso can be computed by smoothing
the image with the Gaussian smoothing mask, followed by
applicationof the Laplacian mask.
Marr-Hildreth edge detector
• Marr and Hildreth argued that the most satisfactory operator fulfilling these
• conditions is the filter 2G where, 2 is the Laplacian operator, and Gisthe
2-D Gaussian function
x2 + y 2
−
G(x, y) =e 2 2
2 G(x, y) 2 G(x, y)
G(x, y) =
2
+
x 2
y2
− x −
x2 + y 2 − y − x2 + y2 2
G(x, y) =
2
e 2 2 + e 2
x 2 y 2
x +y 2 2
x +y 2 2
x 2
1 − y 2
1 −
2 G(x, y) = 4 − 2 e 2 + 4 − 2 e 2
2 2
x2 + y 2
x + y − 2
2 2 2 −
G(x, y) =
2
e 2 2
4
This expression is called Laplacian of a Gaussion
(LoG)
More Advanced Techniques for Edge
Detection
Detection of Discontinuities Gradient
Operators: Example
Sobel gradient
2,3,4
1,4
Edge Linking and Boundary Detection Hough
Transform Example
Thresholding is a phenomenon which occurs due to extreme contrast stretching. In
the contrast stretching diagram if we make the first and the last slope zero
(r1=r2=0) and we increase the center slope, we will get a thresholding
transformation.
s=0; if r<=a
s=L−1; if r\gta
where L is the number of grey levels.
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.
1 if f (x,y) T
g(x, y) =
0 f f (x, y) T
– to background if f(x,y) T1
a if f (x, y) T2
g(x, y) = b if T1 f (x, y) T2
c if f (x, y) T1
Thresholding
Thresholding
Role of Noise in Image Thresholding
Role of Illumination in Image Thresholding
• Assume seed point indicated by underlines. Let the seed pixels 1 and
9 represent the regions C and D, respectively
• Subtract pixel from seed value
• If the difference is less than or equal to 4 (i.e. T=4), merge the pixel
with that region. Otherwise, merge the pixel with the other region.
Split and Merge Algorithm
• Region growing algorithm is slow
• So seed point can be extended to a seed region
• Instead of a single pixel, a node of a Regional adjacency graph
(RAG)
• a region itself is now considered as a starting point.
• The split process can be stated as follows:
1. Segment the image into regions R1, R2,….Rn using a set of
thresholds
2. Create RAG. Use a similarity measure and formulate a homogeneity
test
3. The homogeneity test is designed based on the similarity criteria
such as intensity or any image statistics
4. Repeat step 3 until no further region exits that requires merging
Region Growing
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
one pixel in that
region (if more, the
regions are merged)
Region Growing
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
one pixel in that
region (if more, the
regions are merged)
Region-Based Segmentation Region
Growing
Fig. 10.41 shows the histogram of Fig. 10.40 (a). It is difficult to
segment the defects by thresholding methods. (Applying region
growing methods are better in thiscase.)