Académique Documents
Professionnel Documents
Culture Documents
9.0 Introduction
9.1 Detection of Discontinuities
9.1.1 Point Detection
9.1.2 Line Detection
9.1.3 Edge Detection
9.2 Spatial Masks
9.3 GRADIENT BASED EDGE DETECTION
9.3.1 Robert
9.3.2 Sobel
9.3.3 PREWITT
9.4 LAPLACIAN BASED EDGE DETECTION
9.4.1 CANNY'S EDGE DETECTION
9.5 Smoothing
9.6 Edge Linking
9.6.1 Local Processing
9.6.2 Hough Transform
9.7 Thresholding
9.7.1 Global thresholding
9.8 Region based segmentation
9.8.1 What is a region?
9.8.2 Partitioning
9.8.3 Boundaries
9.8.4 Quad-trees
9.8.5 Region growin
9.8.6 Region merging
9.8.7 Split
9.8.8 Split & merge
9.0 Introduction
Image Segmentation is a process of dividing or partitioning the digital image into number of
small segment. The main aim of the Image Segmentation is to simplify and/or change the
representation of Image into suitable format that is easy for understand and analysis.Image
segmentation is used to locate objects and boundaries i..e line ,curve etc of an image.
The result of image Segmentation consist set of segments that covers the entire image or a set
of contour extracted from an image.In particular region,each pixel are similar having some
characteristics or property such as colour, intensity or texture
9
R=w1z1 + w2z2 +……….+ w9z9 = ∑wizi
Where zi is the gray level of the pixel in an image that associated with mask coefficient wi
The four mask is used for detecting horizontal lines, vertical lines, rising line with the angle 45
degree and falling lines with the angles of -45 degree
for all ji, that point is said to be more likely associated with a line in the direction of mask i.
9.1.3 Edge Detection
Edge detection is used to identifying pixels in the digital image at which image change its
brightness sharply or consist certain discontinuities. The point at which image change its
brightness sharply are typically organized into a set of curved line segments called edges.
The problem is used to find in the 1D signal is called as step detection and the problem used to
find out signal discontinuities overtime is called as change detection. Edge detection is an
important tool in image processing, machine vision and computer vision in the area of feature
detection and feature extraction.
An edge is an boundary between two regions with relative gray level properties. The most edge
detection technique use the concept of relative derivative operator
The following figure illustrates the concepts of relative derivative operator. The picture on the
right shows an image of light stripe on a dark background, the gray level profile of a horizontal
line. And the first and second derivative of the profile. The first Derivative has a positive value
when the image changes from dark to light and zero where the image remains constant. The
second Derivative is positive some part of image transition associated with dark side of the
edge and negative for transition associated with the light side of the edge. The Magnitude of
first derivative is used to detect the presence of edge in the image and the magnitude of the
second derivative is used to detect whether a pixel lies on the dark or light side of an edge.
We used two dimensional spatial mask to find different location in an image. the working
principle of mask is similar to filter except it operates in two dimensionally. The operation of
mask is it centered upon each pixel in an image and calculated the weight
w_1 w_2 w_3
w_4 w_5 w_6
w_7 w_8 w_9
Mask
In the edge detection technique the assumption is made that the edge are with pixel have a
high gradient. The faster change of intensity at some direction given by angle of the gradient
vector is observed at edge pixel. At the pixel level, the intensity of the pixel change from 0 to
255 at the direction of the gradient. The magnitude of the gradient signifies the strength of an
edge . if we calculate the gradient at uniform region we get 0 vector which means that there is
no edge pixel
In natural image we usually do not have the ideal discontinuity or uniform region as in the
figure and we process the magnitude of gradient in order to make decision to detect the edge
pixels. The simplest method is used to applying a threshold. If the gradient magnitude is larger
than the threshold value that will decide the corresponding pixel is an edge pixel.
As with the previous 2 x 2 gradient operator, the differences are computed at the
interpolated point [i + 1/2, j + 1/2]. The Roberts operator is an approximation to the
continuous gradient at this interpolated point and not at the point [i, j] as might be
expected.
9.3.2 SOBEL
In order to avoid having the gradient calculated about an interpolated point between
pixels is to use a 3 x 3 neighborhood for the gradient calculations. Consider the
arrangement of pixels about the pixel [i, j] shown in the Figure The Sobel operator is the
magnitude of the gradient computed by
Like the other gradient operators, Sx and Sy can be implemented using convolution
masks
Note that this operator places an emphasis on pixels that are closer to the center of the
mask. The Sobel operator is one of the most commonly used edge detectors
9.3.3 PREWITT
The Prewitt operator uses the same equations as the Sobel operator, except that the
constant c = 1. Therefore
Note that, unlike the Sobel operator, this operator does not place any emphasis on
pixels that are closer to the center of the masks.
9.4 LAPLACIAN BASED EDGE DETECTION
The edge points of an image can be detected by finding the zero crossings of the second
derivative of the image intensity. The idea is illustrated for a 1D signal in Figure
However, calculating 2nd derivative is very sensitive to noise. This noise should be
filtered out before edge detection. To achieve this, “Laplacian of Gaussian” is used. This
method combines Gaussian filtering with the Laplacian for edge detection.
In Laplacian of Gaussian edge detection there are mainly three steps:
· Filtering,
· Enhancement,
· and detection.
Gaussian filter is used for smoothing and the second derivative of which is used for the
enhancement step. The detection criterion is the presence of a zero crossing in the
second derivative with the corresponding large peak in the first derivative.
In this approach, firstly noise is reduced by convoluting the image with a Gaussian
filter. Isolated noise points and small structures are filtered out. With smoothing;
however; edges are spread. Those pixels, that have locally maximum gradient, are
considered as edges by the edge detector in which zero crossings of the second
derivative are used. To avoid detection of insignificant edges, only the zero crossings
whose corresponding first derivative is above some threshold, are selected as edge
point. The edge direction is obtained using the direction in which zero crossing occurs.
The output of the Laplacian of Gaussian (LoG) operator; h(x,y); is obtained by the
convolution operation:
Where
· Convolve the image with a gaussian smoothing filter and compute the Laplacian of
the result,
· Convolve the image with the linear filter that is the Laplacian of the Gaussian filter.
This is also the case in the LoG. Smoothing (filtering) is performed with a Gaussian filter,
enhancement is done by transforming edges into zero crossings and detection is done by
detecting the zero crossings.
9.4.1 CANNY'S EDGE DETECTION
· Compute the gradient magnitude and orientation using finite-difference approximations for
the partial derivatives,
Canny edge detector approximates the operator that optimizes the product of signal-to-noise
9.5 Smoothing:
Let I[I,j] denote the image; be a Gaussian smoothing filter G[I,j, σ] where σ is the spread of
the Gaussian and controls the degree of smoothing. The result of convolution of I[I,j] with G[I,j,
σ] gives an array of smoothed data as:
There are two common properties that we consider the pixels or points are linked
together
1) Strength of the response of the gradient operator
2) The direction of the gradient
1) The Strength of the Gradient: we already known the gradient operator like
Prewitt and sobel operators.
|F |=[F2x + F2y ] 1/2
Where Fxgradient in the x-direction.
Fygradient in the y- direction.
A pixel in the neighbourhood pixel F(x,y) is linked to the pixel (x,y) if
|F(x,y)- F(x’,y’)|≤T
Where T is a non-negative threshold
F(x,y) means that the image obtained after using the sodel or prewitts filters.
2) The Direction of the Gradient: the direction of the gradient’s vector is given by
the equation
α (x,y)=tan-1 (Fx/Fy)
where Fx x gradient image
Fy y gradient image
A pixel in the neighbourhood pixel α (x,y) is linked to the pixel (x,y) if they have
similar angle is given by following equation
| α (x,y)- α (x’,y’)|< A
All pixels which lie on the same line in (x,y) space are represented by lines which all pass
through a single point in (m,c) space.
The single point through which they all pass gives the values of m and c in the equation
of the line y=mx+c.
Quantise (m,c) space into a two-dimensional array A for appropriate steps of m and c.
Initialise all elements of A(m,c) to zero.
For each pixel (x',y') which lies on some edge in the image, we add 1 to all elements of
A(m,c) whose indices m and c satisfy y'=mx'+c.
Search for elements of A(m,c) which have large values -- Each one found corresponds to
a line in the original image.
One useful property of the Hough transform is that the pixels which lie on the line need not all be
contiguous
For example, all of the pixels lying on the two dotted lines in Fig. will be recognized as lying on
the same straight line. This can be very useful when trying to detect lines with short breaks in
them due to noise, or when objects are partially occluded as shown.
On the other hand, it can also give misleading results when objects happen to be aligned by chance, as
shown by the two dotted lines in Fig. .
Indeed, this clearly shows that one disadvantage of the Hough transform method is that it gives an
infinite line as expressed by the pair of m and c values, rather than a finite line segment with two well-
defined endpoints.
One practical detail is that the y=mx+c form for representing a straight line breaks down for
vertical lines, when m becomes infinite.
To avoid this problem, it is better to use the alternative formulation given earlier,
xcosθ + ysinθ==r1
9.7 Thresholding
Segmentation divides an image into its constituent regions or objects.Segmentation of non trivial
images is one of the difficult task in image processing. Segmentation accuracy determines the
eventual success or failure of computerized analysis procedure.Example Application: Automated
inspection of electronic assemblies. (mother boards)
Segmentation algorithms are based on one of two basic properties of intensity values
discontinuity and similarity.First category is to partition an image based on abrupt changes in
intensity, such as edges in an image.Second category are based on partitioning an image into
regions that are similar according to a predefined criteria. Histogram Thresholding approach falls
under this category.
Histogram are constructed by splitting the range of the data into equal-sized bins (called
classes). Then for each bin, the number of points from the data set that fall into each bin
are counted. Vertical axis: Frequency (i.e., counts for each bin) Horizontal axis:
Response variable. In image histograms the pixels form the horizontal axis
Thresholding – Foundation
Suppose that the gray-level histogram corresponds to an image, f(x,y), composed of dark
objects in a light background, in such a way that object and background pixels have gray
levels grouped into two dominant modes. One obvious way to extract the objects from
the background is to select a threshold ‘T’ that separates these modes. Then any point
(x,y) for which f(x,y) > T is called an object point, otherwise, the point is called a
background point.
If for example an image is composed of two types of light objects on a dark background,
three or more dominant modes characterize the image histogram.
if f(x,y) > T2
Thresholding is the simplest segmentation method. The pixels are partitioned depending
on their intensity value.
0, if f (x , y ) ≤ T
Multiple thresholding:
a, if f (x , y ) > T2
g (x , y ) = b, if T1 < f (x , y ) ≤ T2
c , if f (x , y ) ≤ T1
Peaks and valleys of the image histogram can help in choosing the appropriate value for
the threshold(s).
Some factors affects the suitability of the histogram for guiding the choice of the
threshold:
A simple algorithm:
1. Initial estimate of T
2. Segmentation using T :
G1, pixels brighter than T ;
G2, pixels darker than (or equal to) T .
3. Computation of the average intensities m1 and m2 of G1
And G2
.4. New threshold value:
Tnew = m1 + m2 /2
5. If |T – Tnew | > ∆T , back to step 2, otherwise stop.
Local properties (e.g., statistics) based criteria can be used for adapting the threshold.
For example:
g (x , y ) =1, if Qxy
0, otherwise
f (x , y ) > Txy
f (x , y ) > aσ xy AND f (x , y ) > bmxy This technique can be easily generalized to multiple
thresholdssegmentation.
9.8.2 Partitioning
• Partitioning into regions done often by using gray values of the image pixels.
• Two general approaches :-
Region-based segmentation
Region Segmentation
• Problem Statement:-
Given a set of image pixels I and a homogeneity predicate P(.), find a partition S of the
image I into a set of n regions Ri such that
Ri True
i 1
P Ri Rj False
Original Image
9.8.3 Boundaries
9.8.4 Quad-trees
This area is divided into four quadrants until it is totally in fore-or background
Quad-trees
Encoding and saving of a quadtree Recursive
•On a leaf: store 0 or 1
•On a node:
-Add a ‘(‘
-store recursively code of the children
-Add a ‘)’
Region merging: initial partition of the image into small homogeneous regions (e.g. 2x2 pixels)
•If two neighbours regions are homogeneous then merge these regions
•Continue until no homogeneous neighboured regions are left
No user set seed points is necessary!
9.8.7 Split
•No seed-points
•Fast and easy
Drawback: over-segmentation
•Usually too many regions are created
Extension of split
First step: do a split!
Then: merge homogeneous partitions
•Check all pairs of neighboured partition if they are
homogeneous with the same criteria
•If yes: merge then
Finish when all partitions are homogeneous