Upload
ishant7890
View
237
Download
0
Embed Size (px)
Citation preview
8/8/2019 Ankit Tech
1/26
EDGE DETECTORS
CONTENTS
1. Introduction.3
2. Problem Definition..6
3. Edge Detection Techniques6
3.1Sobel Operator..6
3.1.1 Snapshots..8
3.2 Prewitts Operator10
3.2.1SnapShots..113.3 Roberts 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 Cannys Operator..19
3.5.1Stages of Canny edge detection19
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
8/8/2019 Ankit Tech
2/26
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 Cannys edge detection algorithm performs better than all these
operators under almost all scenarios. Evaluation of the images showed that under noisyconditions Canny, LoG( Laplacian of Gaussian), Robert, Prewitt, Sobel exhibit better
performance, respectively. 1. It has been observed that Cannys edge detection algorithm is
computationally more expensive compared to LoG( Laplacian of Gaussian), Sobel, Prewitt and
Roberts operator.
2 Dept of CS & E
8/8/2019 Ankit Tech
3/26
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 (a2-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 inthe 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 diagonaledges. 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 discountlocalized 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 falseedge 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:
Gradient based Edge Detection:
The gradient method detects the edges by looking for the maximum and minimum in the first
derivative of the image.
Laplacian based Edge Detection:
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 bythe jump in intensity below:
3 Dept of CS & E
8/8/2019 Ankit Tech
4/26
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 getthe 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 detectionfilters 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 valueto the threshold value and detect an edge whenever the threshold is exceeded. Furthermore, when
4 Dept of CS & E
8/8/2019 Ankit Tech
5/26
EDGE DETECTORS
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
8/8/2019 Ankit Tech
6/26
EDGE DETECTORS
2. PROBLEM DEFINITION
There are problems of false edge detection, missing true edges, producing thin or thick lines andproblems 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 tonoise etc. The software is developed using Visual C++ 6.0.
3. Edge Detection Techniques
There are various edge detection algorithms available depending upon their method. The onesthat we are going to discuss in this report are:-
Sobel's Operator.
Prewitts Operator.
Roberts Operator.
Laplacian of Gaussian.
Cannys Edge Detector.
3.1 Sobels Operator
The Sobel operator is used in image processing The Sobel operator is used in image
processing, particularly withinedge detection algorithms. Technically, it is a discrete
differentiation operator, computing an approximation of the gradientof the image intensity
function. At each point in the image, the result of the Sobel operator is either the corresponding
gradient vector or the norm of this vector. The Sobel operator is based on convolving the image
with a small, separable, and integer valued filter in horizontal and vertical direction and is
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 inthe image.ssing, particularly within edge detection algorithms. Technically, it is a discrete
differentiation operator, computing an approximation of the gradient of the image intensity
function. At each point in the image, the result of the Sobel operator is either the corresponding
gradient vector or the norm of this vector. The Sobel operator is based on convolving the image
with a small, separable, and integer valued filter in horizontal and vertical direction and is
6 Dept of CS & E
http://en.wikipedia.org/wiki/Edge_detectionhttp://en.wikipedia.org/wiki/Edge_detectionhttp://en.wikipedia.org/wiki/Difference_operatorhttp://en.wikipedia.org/wiki/Difference_operatorhttp://en.wikipedia.org/wiki/Image_gradienthttp://en.wikipedia.org/wiki/Image_gradienthttp://en.wikipedia.org/wiki/Difference_operatorhttp://en.wikipedia.org/wiki/Difference_operatorhttp://en.wikipedia.org/wiki/Image_gradienthttp://en.wikipedia.org/wiki/Edge_detection8/8/2019 Ankit Tech
7/26
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 33 convolution kernels as shown in Figure 1. One kernel issimply 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:
Typically, an approximate magnitude is computed using:
7 Dept of CS & E
8/8/2019 Ankit Tech
8/26
EDGE DETECTORS
which is much faster to compute.
The angle of orientation of the edge (relative to the pixel grid) giving rise to the spatial gradient
is given by:
q = arctan(Gy /Gx)
3.1.1 SnapShots
Edge detection at threshold 100
Edge detection at threshold 50
8 Dept of CS & E
8/8/2019 Ankit Tech
9/26
EDGE DETECTORS
Edge detection at threshold 150
Edge detection at threshold 100
Edge detection at threshold 50
9 Dept of CS & E
8/8/2019 Ankit Tech
10/26
EDGE DETECTORS
Edge detection at threshold 150
3.2 Prewitts Operator
Prewitt operator [5] is similar to the Sobel operator and is used for detecting vertical andhorizontal 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.
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
10 Dept of CS & E
8/8/2019 Ankit Tech
11/26
EDGE DETECTORS
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
Edge detection at threshold 100
11 Dept of CS & E
8/8/2019 Ankit Tech
12/26
EDGE DETECTORS
Edge detection at threshold 50
Edge detection at threshold 150
12 Dept of CS & E
8/8/2019 Ankit Tech
13/26
EDGE DETECTORS
Edge detection at threshold 100
Edge detection at threshold 50
Edge detection at threshold 150
3.3Roberts 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
8/8/2019 Ankit Tech
14/26
EDGE DETECTORS
3.3.1How it works
In theory, the operator consists of a pair of 22 convolution masksas shownin 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 tothe pixel grid, one mask for each of the two perpendicular orientations. Themasks can be applied separately to the input image, to produce separatemeasurements of the gradient componenting each orientation (call these Gxand Gy). These can then be combined together to find the absolutemagnitude of the gradient at each point and the orientation of that gradient.The gradient magnitude is given by:
although typically, an approximate magnitude is computed using:
which is much faster to compute.
14 Dept of CS & E
8/8/2019 Ankit Tech
15/26
EDGE DETECTORS
The angle of orientation of the edge giving rise to the spatial gradient(relative to the pixel grid orientation) is given by:
In this case, orientation 0 is taken to mean that the direction of maximumcontrast fromblack to white runs from left to right on the image, and other angles aremeasured anticlockwise from this.Often, the absolute magnitude is the only output the user sees --- the twocomponents of the gradient are conveniently computed and added in asingle pass over the input image using the pseudo-convolution operatorshown in Figure.
Using this mask the approximate magnitude is given by:
3.3.2SnapShots
15 Dept of CS & E
8/8/2019 Ankit Tech
16/26
EDGE DETECTORS
Edge detection at threshold 100
Edge detection at threshold 50
16 Dept of CS & E
8/8/2019 Ankit Tech
17/26
EDGE DETECTORS
Edge detection at threshold 150
Edge detection at threshold 100
Edge detection at threshold 50
17 Dept of CS & E
8/8/2019 Ankit Tech
18/26
EDGE DETECTORS
Edge detection at threshold 150
3.4 Laplacian of Gaussian
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 oftenoccur 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 isusually 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 thenfewer 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
8/8/2019 Ankit Tech
19/26
EDGE DETECTORS
The core of the zero crossing detector is the Laplacian of Gaussian filter and so a knowledge ofthat 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. Oftenzero 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 haveto mark each foreground point that has at least one background neighbour.
3.5 Canny edge detector
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
8/8/2019 Ankit Tech
20/26
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.
3.5.1 STAGES OF CANNYS EDGE DETECTOR
3.5.1.1 Noise reduction
The Canny edge detector uses a filter based on the first derivative of a Gaussian, because it is
susceptible to noise present on raw unprocessed image data, so to begin with, the raw image
is convolved with a Gaussian filter. The result is a slightly blurred version of the original which
is not affected by a single noisy pixel to any significant degree.
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
http://en.wikipedia.org/wiki/Image_noise_reductionhttp://en.wikipedia.org/wiki/Image_noise_reduction8/8/2019 Ankit Tech
21/26
EDGE DETECTORS
3.5.1.2 Finding the intensity gradient of the image
An edge in an image may point in a variety of directions, so the Canny algorithm uses four filters
to detect horizontal, vertical and diagonal edges in the blurred image. The edge detection
operator (Roberts, Prewitt, Sobel for example) returns a value for the first derivative in the
horizontal direction (Gy) and the vertical direction (Gx). From this the edge gradient and
direction can be determined:
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).
3.5.1.3 Non-maximum suppression
Given estimates of the image gradients, a search is then carried out to determine if the gradient
magnitude assumes a local maximum in the gradient direction. So, 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
8/8/2019 Ankit Tech
22/26
EDGE DETECTORS
3.5.1.4 Tracing edges through the image and hysteresis thresholding
Intensity gradients which are large are more likely to correspond to edges than if they are small.
It is in most cases impossible to specify a threshold at which a given intensity gradient switchesfrom corresponding to an edge into not doing so. Therefore Canny uses thresholding with
hysteresis.
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.
3.5.1.5 Differential geometric formulation of the Canny edge detector
A more refined approach to obtain edges with sub-pixel accuracy is by using the approach
ofdifferential edge detection, where the requirement of non-maximum suppression is formulated
in terms of second- and third-order derivatives computed from a scale-space representation
(Lindeberg 1998) see the article on edge detection for a detailed description.
22 Dept of CS & E
http://en.wikipedia.org/wiki/Edge_detection#Differential_edge_detectionhttp://en.wikipedia.org/wiki/Scale-spacehttp://en.wikipedia.org/wiki/Edge_detection#Differential_edge_detectionhttp://en.wikipedia.org/wiki/Edge_detection#Differential_edge_detectionhttp://en.wikipedia.org/wiki/Scale-spacehttp://en.wikipedia.org/wiki/Edge_detection#Differential_edge_detection8/8/2019 Ankit Tech
23/26
EDGE DETECTORS
3.5.1.6 Variational-geometric formulation of the Haralick-Canny edgedetector
A variational explanation for the main ingredient of the Canny edge detector, that is, finding the
zero crossings of the 2nd derivative along the gradient direction, was shown to be the result of
minimizing a Kronrod-Minkowski functional while maximizing the integral over the alignment
of the edge with the gradient field (Kimmel and Bruckstein 2003) see article on regularized
Laplacian zero crossings and other optimal edge integrators for a detailed description.
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
8/8/2019 Ankit Tech
24/26
EDGE DETECTORS
Edge detection at threshold 80
4.CONCLUSION
24 Dept of CS & E
8/8/2019 Ankit Tech
25/26
EDGE DETECTORS
In this complete analysis of the edge detectors present there was a comparision between the
following edge detectors:-
Sobel's Operator.
Prewitts Operator.
Roberts Operator. Laplacian of Gaussian.
Cannys 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 ofthreshold 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 thismethod 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
8/8/2019 Ankit Tech
26/26
EDGE DETECTORS
Canny, J.,A Computational Approach To Edge Detection, IEEE Trans. Pattern Analysis
and Machine Intelligence
R. Deriche, Using Canny's criteria to derive a recursively implemented optimal edge
detector, Int. J. Computer Vision
M. Heath, S. Sarkar, T. Sanocki, and K.W. Bowyer, "A Robust Visual Method for
Assessing the Relative Performance of Edge-Detection Algorithms" IEEE Transactionson 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. R. Fram and E. S. Deutsch, On the quantitative evaluation of edge detection schemes
and their comparison with human performance, IEEETrans. Comput. C-24, 1975.
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 D t f CS & E