Professional Documents
Culture Documents
CONTENTS
1. Introduction…………………………………………………………………….3
2. Problem Definition……………………………………………………………..6
3. Edge Detection Techniques……………………………………………………6
3.1 Sobel Operator……………………………………………………………..6
3.1.1 Snapshots……………………………………………………………..8
3.2 Prewitt’s Operator…………………………………………………………10
3.2.1SnapShots……………………………………………………………..11
3.3 Robert’s Operator………………………………………………………….13
3.3.1 How It works ………………………………………………………...13
3.3.2 Snapshots…………………………………………………………..…15
3.4 Laplacian on Gaussian …………………………………………………….18
3.4.1 How It Works ………………………………………………………..18
3.5 Canny’s Operator…………………………………………………………..19
3.5.1Stages of Canny edge detection………………………………………19
3.5.1.1 Noise Reduction ……………………………………………....19
3.5.1.2 Finding intensity gradient……………………………………..20
3.5.1.3 Non max suppression……………………………………….....20
3.5.1.4 Tracing edge through image…………………………………...21
3.5.1.5 Different geometric formulation……………………………….22
3.5.1.6 Vibrational Geometric Formulation ………………………….22
3.5.2 Parameters……………………………………………………………..22
3.5.3 Snapshots……………………………………………………………….23
4. Conclusion………………………………………………………………………….24
5. References…………………………………………………………………………..25
1 Dept of CS &
E
EDGE DETECTORS
ABSTRACT
Edges characterize boundaries and are therefore a problem of fundamental importance in image
processing. Image Edge detection significantly reduces the amount of data and filters out useless
information, while preserving the important structural properties in an image. Since edge
detection is in the forefront of image processing for object detection, it is crucial to have a good
understanding of edge detection algorithms. In this report the comparative analysis of various
Image Edge Detection techniques is presented. The software is developed using Visual C++ 6.0.
It has been shown that the Canny’s edge detection algorithm performs better than all these
operators under almost all scenarios. Evaluation of the images showed that under noisy
conditions Canny, LoG( Laplacian of Gaussian), Robert, Prewitt, Sobel exhibit better
performance, respectively. 1. It has been observed that Canny’s edge detection algorithm is
computationally more expensive compared to LoG( Laplacian of Gaussian), Sobel, Prewitt and
Robert’s operator.
2 Dept of CS &
E
EDGE DETECTORS
1. INTRODUCTION
Edge detection refers to the process of identifying and locating sharp discontinuities in an image.
The discontinuities are abrupt changes in pixel intensity which characterize boundaries of objects
in a scene .Classical methods of edge detection involve convolving the image with an operator (a
2-D filter), which is constructed to be sensitive to large gradients in the image while returning
values of zero in uniform regions. There are an extremely large number of edge detection
operators available, each designed to be sensitive to certain types of edges. Variables involved in
the selection of an edge detection operator include Edge orientation, Noise environment and
Edge structure. The geometry of the operator determines a characteristic direction in which it is
most sensitive to edges. Operators can be optimized to look for horizontal, vertical, or diagonal
edges. Edge detection is difficult in noisy images, since both the noise and the edges contain high
frequency content. Attempts to reduce the noise result in blurred and distorted edges. Operators
used on noisy images are typically larger in scope, so they can average enough data to discount
localized noisy pixels. This results in less accurate localization of the detected edges. Not all
edges involve a step change in intensity. Effects such as refraction or poor focus can result in
objects with boundaries defined by a gradual change in intensity . The operator needs to be
chosen to be responsive to such a gradual change in those cases. So, there are problems of false
edge detection, missing true edges, edge localization, high computational time and problems due
to noise etc. Therefore, the objective is to do the comparison of various edge detection
techniques and analyse the performance of the various techniques in different conditions.
There are many ways to perform edge detection. However, the majority of different methods
may be grouped into two categories:
The gradient method detects the edges by looking for the maximum and minimum in the first
derivative of the image.
The Laplacian method searches for zero crossings in the second derivative of the image to find
edges. An edge has the one-dimensional shape of a ramp and calculating the derivative of the
image can highlight its location. Suppose we have the following signal, with an edge shown by
the jump in intensity below:
3 Dept of CS &
E
EDGE DETECTORS
Suppose we have the following signal, with an edge shown by the jump in intensity below:
If we take the gradient of this signal (which, in one dimension, is just the first derivative with
respect to t) we get
the following:
Clearly, the derivative shows a maximum located at the center of the edge in the original signal.
This method of locating an edge is characteristic of the “gradient filter” family of edge detection
filters and includes the Sobel method. A pixel location is declared an edge location if the value of
the gradient exceeds some threshold. As mentioned before, edges will have higher pixel intensity
values than those surrounding it. So once a threshold is set, you can compare the gradient value
4 Dept of CS &
E
EDGE DETECTORS
to the threshold value and detect an edge whenever the threshold is exceeded. Furthermore, when
the first derivative is at a maximum, the second derivative is zero. As a result, another alternative
to finding the location of an edge is to locate the zeros in the second derivative. This method is
known as the Laplacian and the second derivative of the signal is shown below:
5 Dept of CS &
E
EDGE DETECTORS
2. PROBLEM DEFINITION
There are problems of false edge detection, missing true edges, producing thin or thick lines and
problems due to noise etc. In this paper we analyzed and did the visual comparison of the most
commonly used Gradient and Laplacian based Edge Detection techniques for problems of
inaccurate edge detection, missing true edges, producing thin or thick lines and problems due to
noise etc. The software is developed using Visual C++ 6.0.
6 Dept of CS &
E
EDGE DETECTORS
therefore relatively inexpensive in terms of computations. On the other hand, the gradient
approximation which it produces is relatively crude, in particular for high frequency variations in
the image.
Mathematically, the gradient of a two-variable function (here the image intensity function) is at
each image point a 2D vector with the components given by the derivatives in the horizontal and
vertical directions. At each image point, the gradient vector points in the direction of largest
possible intensity increase, and the length of the gradient vector corresponds to the rate of change
in that direction. This implies that the result of the Sobel operator at an image point which is in a
region of constant image intensity is a zero vector and at a point on an edge is a vector which
points across the edge, from darker to brighter values.
The operator consists of a pair of 3×3 convolution kernels as shown in Figure 1. One kernel is
simply the other rotated by 90°.
These kernels are designed to respond maximally to edges running vertically and horizontally
relative to the pixel grid, one kernel for each of the two perpendicular orientations. The kernels
can be applied separately to the input image, to produce separate measurements of the gradient
component in each orientation (call these Gx and Gy). These can then be combined together to
find the absolute magnitude of the gradient at each point and the orientation of that gradient . The
gradient magnitude is given by:
7 Dept of CS &
E
EDGE DETECTORS
3.1.1 SnapShots
8 Dept of CS &
E
EDGE DETECTORS
9 Dept of CS &
E
EDGE DETECTORS
Prewitt operator [5] is similar to the Sobel operator and is used for detecting vertical and
horizontal edges in images.
Various kernels can be used for this operation. The whole set of 8 kernels is produced by taking
one of the kernels and rotating its coefficients circularly. Each of the resulting kernels is sensitive
to an edge orientation ranging from 0° to 315° in steps of 45°, where 0° corresponds to a vertical
edge. The maximum response for each pixel is the value of the corresponding pixel in the output
magnitude image. The values for the output orientation image lie between 1 and 8, depending on
which of the 8 kernels produced the maximum response.
The Prewitt edge detector is an appropriate way to estimate the magnitude and orientation of an
edge. Although differential gradient edge detection needs a rather time-consuming calculation to
estimate the orientation from the magnitudes in the x- and y-directions, the Prewitt edge
detection obtains the orientation directly from the kernel with the maximum response. The set of
kernels is limited to 8 possible orientations; however experience shows that most direct
orientation estimates are not much more accurate.
10 Dept of CS &
E
EDGE DETECTORS
On the other hand, the set of kernels needs 8 convolutions for each pixel, whereas the set of
kernel in gradient method needs only 2, one kernel being sensitive to edges in the vertical
direction and one to the horizontal direction. The result for the edge magnitude image is very
similar with both methods, provided the same convolving kernel is used.
3.2.1 SnapShots
11 Dept of CS &
E
EDGE DETECTORS
12 Dept of CS &
E
EDGE DETECTORS
3.3Robert’s Operator
The Roberts operator performs a simple, quick to compute, 2-D spatial gradient measurement on
an image. It thus highlights regions of high spatial gradient which often correspond to edges. In
its most common usage, the input to the operator is a grey scale image, as is the output. Pixel
values at each point in the output represent the estimated absolute magnitude of the spatial
gradient of the input image at that point.
13 Dept of CS &
E
EDGE DETECTORS
3.3.1How it works
In theory, the operator consists of a pair of 2×2 convolution masks as shown in Figure.
One mask is simply the other rotated by 90°. This is very similar to the Sobel operator.
These masks are designed to respond maximally to edges running at 45° to the pixel grid, one
mask for each of the two perpendicular orientations. The masks can be applied separately to the
input image, to produce separate measurements of the gradient componenting each orientation
(call these Gx and Gy). These can then be combined together to find the absolute magnitude of
the gradient at each point and the orientation of that gradient. The gradient magnitude is given
by:
The angle of orientation of the edge giving rise to the spatial gradient (relative to the pixel grid
orientation) is given by:
14 Dept of CS &
E
EDGE DETECTORS
In this case, orientation 0 is taken to mean that the direction of maximum contrast from
black to white runs from left to right on the image, and other angles are measured anticlockwise
from this.
Often, the absolute magnitude is the only output the user sees --- the two components of the
gradient are conveniently computed and added in a single pass over the input image using the
pseudo-convolution operator shown in Figure.
3.3.2 SnapShots
15 Dept of CS &
E
EDGE DETECTORS
16 Dept of CS &
E
EDGE DETECTORS
17 Dept of CS &
E
EDGE DETECTORS
The zero crossing detector looks for places in the Laplacian of an image where the value of the
Laplacian passes through zero i.e. points where the Laplacian changes sign. Such points often
occur at `edges' in images i.e. points where the intensity of the image changes rapidly, but they
also occur at places that are not as easy to associate with edges. It is best to think of the zero
crossing detector as some sort of feature detector rather than as a specific edge detector. Zero
crossings always lie on closed contours and so the output from the zero crossing detector is
usually a binary image with single pixel thickness lines showing the positions of the zero
crossing points.
The starting point for the zero crossing detector is an image which has been filtered using the
Laplacian of Gaussian filter. The zero crossings that result are strongly influenced by the size of
the Gaussian used for the smoothing stage of this operator. As the smoothing is increased then
fewer and fewer zero crossing contours will be found, and those that do remain will correspond
to features of larger and larger scale in the image.
3.4.1How It Works
18 Dept of CS &
E
EDGE DETECTORS
The core of the zero crossing detector is the Laplacian of Gaussian filter and so a knowledge of
that operator is assumed here. As described there, `edges' in images give rise to zero crossings in
the LoG output. For instance, Figure shows the response of a 1-D LoG filter to a step edge in the
image.
However, zero crossings also occur at any place where the image intensity gradient starts
increasing or starts decreasing, and this may happen at places that are not obviously edges. Often
zero crossings are found in regions of very low gradient where the intensity gradient wobbles up
and down around zero. Once the image has been LoG filtered, it only remains to detect the zero
crossings. This can be done in several ways.
The simplest is to simply threshold the LoG output at zero, to produce a binary image
where the boundaries between foreground and background regions represent the locations of zero
crossing points. These boundaries can then be easily detected and marked in single pass, e.g.
using some morphological operator. For instance, to locate all boundary points, we simply have
to mark each foreground point that has at least one background neighbour.
The Canny edge detection operator was developed by John F. Canny in 1986 and uses a multi-
stage algorithm to detect a wide range of edges in images. Most importantly, Canny also
produced a computational theory of edge detection explaining why the technique works.
Canny's aim was to discover the optimal edge detection algorithm. In this situation, an "optimal"
edge detector means:
Good detection – the algorithm should mark as many real edges in the image as possible.
Good localization – edges marked should be as close as possible to the edge in the real
image.
Minimal response – a given edge in the image should only be marked once, and where
possible, image noise should not create false edges.
19 Dept of CS &
E
EDGE DETECTORS
To satisfy these requirements Canny used the calculus of variations – a technique which finds
the function which optimizes a given functional. The optimal function in Canny's detector is
described by the sum of four exponential terms, but can be approximated by the
first derivative of a Gaussian.
Here is an example of a 5x5 Gaussian filter, used to create the image to the right, with σ = 1.4:
20 Dept of CS &
E
EDGE DETECTORS
The edge direction angle is rounded to one of four angles representing vertical, horizontal and
the two diagonals (0, 45, 90 and 135 degrees for example).
if the rounded angle is zero degrees the point will be considered to be on the edge if its
intensity is greater than the intensities in the west and east directions,
if the rounded angle is 90 degrees the point will be considered to be on the edge if its
intensity is greater than the intensities in the north and south directions,
if the rounded angle is 135 degrees the point will be considered to be on the edge if its
intensity is greater than the intensities in the north west and south east directions,
if the rounded angle is 45 degrees the point will be considered to be on the edge if its
intensity is greater than the intensities in the north east and south west directions.
This is worked out by passing a 3x3 grid over the intensity map.
From this stage referred to as non-maximum suppression, a set of edge points, in the form of
a binary image, is obtained. These are sometimes referred to as "thin edges".
21 Dept of CS &
E
EDGE DETECTORS
Thresholding with hysteresis requires two thresholds – high and low. Making the assumption that
important edges should be along continuous curves in the image allows us to follow a faint
section of a given line and to discard a few noisy pixels that do not constitute a line but have
produced large gradients. Therefore we begin by applying a high threshold. This marks out the
edges we can be fairly sure are genuine. Starting from these, using the directional information
derived earlier, edges can be traced through the image. While tracing an edge, we apply the
lower threshold, allowing us to trace faint sections of edges as long as we find a starting point.
Once this process is complete we have a binary image where each pixel is marked as either an
edge pixel or a non-edge pixel. From complementary output from the edge tracing step, the
binary edge map obtained in this way can also be treated as a set of edge curves, which after
further processing can be represented as polygons in the image domain.
22 Dept of CS &
E
EDGE DETECTORS
3.5.2 Parameters
The Canny algorithm contains a number of adjustable parameters, which can affect the
computation time and effectiveness of the algorithm.
The size of the Gaussian filter: the smoothing filter used in the first stage directly affects
the results of the Canny algorithm. Smaller filters cause less blurring, and allow detection of
small, sharp lines. A larger filter causes more blurring, smearing out the value of a given
pixel over a larger area of the image. Larger blurring radii are more useful for detecting
larger, smoother edges – for instance, the edge of a rainbow.
Thresholds: the use of two thresholds with hysteresis allows more flexibility than in a
single-threshold approach, but general problems of thresholding approaches still apply. A
threshold set too high can miss important information. On the other hand, a threshold set too
low will falsely identify irrelevant information (such as noise) as important. It is difficult to
give a generic threshold that works well on all images. No tried and tested approach to this
problem yet exists.
3.5.3 SnapShots
23 Dept of CS &
E
EDGE DETECTORS
4.CONCLUSION
24 Dept of CS &
E
EDGE DETECTORS
In this complete analysis of the edge detectors present there was a comparision between the
following edge detectors:-
Sobel's Operator.
Prewitt’s Operator.
Robert’s Operator.
Laplacian of Gaussian.
Canny’s Edge Detector.
It is seen that the Robert ,sobel and prewitt edge detectors are the easiest to implement edge
detectors, but do not give proper results at very low threshold values and also at very high
threshold.
One more thing is then setting up of threshold values, if we set a particular threshold value and
use it for all the images it will not give us proper results as for each image the threshold are
different , so one way to overcome this problem is to use an automatic threshold metho. But this
method is very complex and will increase the computational time and hence cannot be used in
real time applications such as Video Processing.
One more thing when considering these edge detectors are that these edge detectors does not
remove Noise in the image and hence gives obsolete edges which are not even a part of the
image.
Considering the Canny Edge detector, it has multiple steps starting from noise reduction to
Calculating the threshold values . It may be a little slow as compared to the other edge detectors
but it gives proper output in all cases.
Thus depending upon our needs and and situation under consideration we can use any of the
available edge detectors.
5.REFERENCES
25 Dept of CS &
E
EDGE DETECTORS
Canny, J., A Computational Approach To Edge Detection, IEEE Trans. Pattern Analysis
and Machine Intelligence
M. Heath, S. Sarkar, T. Sanocki, and K.W. Bowyer, "A Robust Visual Method for
Assessing the Relative Performance of Edge-Detection Algorithms" IEEE Transactions
on Pattern Analysis and Machine Intelligence
M. Gokmen and C. C. Li, Edge detection and surface reconstruction using refined
regularization, IEEE Trans. Pattern Anal. Mach. Intell
R. Hummel and V. Sundareswaran, Motion parameter estimation from flobal flow field
data, IEEE Trans. Pattern Anal. Mach. Intell. May,1993
J. Basak, B. Chandra, and D. D. Mazumdar, On edge and line linking with connectionist
models, IEEE Trans. Systems, Man, and Cybernetics 24, 1994,
26 Dept of CS &
E