Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/229014057

Comparative study of edge detection algorithms applying on the grayscale


noisy image using morphological filter

Article · December 2006

CITATIONS READS

108 3,586

1 author:

Mohamed Roushdy
Ain Shams University
74 PUBLICATIONS   294 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Computer Graphic View project

Vision-Based Topological SLAM for Autonomous Robots View project

All content following this page was uploaded by Mohamed Roushdy on 21 May 2014.

The user has requested enhancement of the downloaded file.


GVIP Journal, Volume 6, Issue 4, December, 2006

Comparative Study of Edge Detection Algorithms Applying on the


Grayscale Noisy Image Using Morphological Filter
Mohamed Roushdy
Computer Science Department,Faculty of Computer and Information Sciences
Ain Shams University, Abbassia, Cairo, Egypt
miroushdy@hotmail.com
http://cis.shams.edu.eg

Abstract [2] and Yakimovsky [3]. The rest of this paper is


In this paper, classified and comparative study of organized as follows. Section (2) reviews edge
edge detection algorithms are presented. detection operators. Section (3) classifies the edge
Experimental results prove that Boie-Cox, Shen- detection algorithms and gives the advantages and
Castan and Canny operators are better than Laplacian disadvantages of these different operators. Section
of Gaussian (LOG), while LOG is better than Prewitt (4) discusses morphological filtering which is very
and Sobel in case of noisy image. Subjective and important process for noisy image. Section (5)
objective methods are used to evaluate the different presents methods of the performance evaluation for
edge operators. The morphological filter is more edge detectors. Section, (6) the experimental result of
important as an initial process in the edge detection many edge detections obtained and finally in section
for noisy image and used opening-closing operation (7) the discussion and conclusion are given.
as preprocessing to filter noise. Also, smooth the
image by first closing and then dilation to enhance 2. Review of previous work
the image before the edge operators affect. In the past two decades several algorithms were
developed to extract the contour of homogeneous
Keywords: Edge detection, image processing, regions within digital image. A lot of the attention is
morphological filter focused to edge detection, being a crucial part in most
of the algorithms. Classically, the first stage of edge
1- Introduction detection (e.g. the gradient operator, Robert operator,
Edge detection is a critical element in image the Sobel operator, the Prewitt operator) is the
processing, since edges contain a major function of evaluation of derivatives of the image intensity.
image information. The function of edge detection is Smoothing filter and surface fitting are used as
to identify the boundaries of homogeneous regions in regularization techniques to make differentiation
an image based on properties such as intensity and more immune to noise. Raman Maini and J. S. Sobel
texture. Many edge detection algorithms have been [4] evaluated the performance of the Prewitt edge
developed based on computation of the intensity detector for noisy image and demonstrated that the
gradient vector, which, in general, is sensitive to noise Prewitt edge detector works quite well for digital
in the image. In order to suppress the noise, some image corrupted with Poisson noise whereas its
spatial averaging may be combined with performance decreases sharply for other kind of noise.
differentiation such as the Laplacian of Gaussian Davis, L. S. [5] has suggested Gaussian pre-
operator and the detection of zero crossing. Canny convolution for this purpose. However, all the
[1] derived analytically optimal step edge operators Gaussian and Gaussian-like smoothing filters, while
and showed that the first derivative of Gaussian filter smoothing out the noise, also remove genuine high-
is a good approximation of such operators. An frequency edge features, degrade localization and
alternative to gradient techniques is based on degrade the detection of low- contrast edges. The
statistical approaches. The idea is to examine the classical operators emphasize the high frequency
distribution of intensity values in the neighborhood of components in the image and therefore act poorly in
a given pixel and determine if the pixel is to be cases of moderate low SNR and/or low spatial
classified as an edge. In comparison with the resolution of the imaging device. The awareness of
differential approaches, less attention has been paid to this has lead to new approaches in which balanced
statistical approaches. However, this method has trade-offs are sought between noise suppression,
been approached by some authors, e.g., Bovik et al. image deblurring and the ability to resolve interfering

17
GVIP Journal, Volume 6, Issue 4, December, 2006

edges, altogether resulting in operators acting like discretized sample. The Laplacian operators compute
band-pass filters e.g. Canny. Sharifi, M. et al. [6] some quantity related to the Laplacian of the
introduces a new classification of most important and underlying image gray tone intensity surface. The
commonly used edge detection algorithms, namely zero-crossing operators determine whether or not the
ISEF, Canny, Marr-Hildreth, Sobel, Kirch and digital Laplacian or the estimated second direction
Laplacian. They discussed the advantages and derivative has a zero-crossing within the pixel. Edge
disadvantages of these algorithms. Shin, M.C et al. detection operators are often implemented with
[7] presented an evaluation of edge detector convolution masks and discrete approximations to
performance using a structure from motion task. differential operators. These operators may return
They found that the Canny detector had the best test magnitude and direction information, some return
performance and the best robustness in convergence magnitude only. Potential edge points are found by
and is one of the faster executing detectors. It examining the relationship a pixel has with its
performs the best for the task of structure from neighbors; an edge implies a change in gray level.
motion. This conclusion is similar to that reached by
Heath et al. [8] in the context of human visual edge
rating experiment. Rital, S. et al. [9] proposed a new 3.1 Gradient operators
algorithm of edge detection based on properties of Gradient operators are based on the idea of using the
hyper graph theory and showed this algorithm is first or second derivative of the gray level. The first
accurate, robust on both synthetic and real image derivative will mark edge points, with steeper gray
corrupted by noise. Li Dong Zhang and Du Yan Bi level changes providing stronger edge points (large
[10] presented an edge detection algorithm that the magnitudes). The second derivative returns two
gradient image is segmented in two orthogonal impulses, one on either side of the edge. An
orientations and local maxima are derived from the advantage of this is that if a line is drawn between the
section curves. They showed that this algorithm can two impulses the position where this line crosses the
improve the edge resolution and insensitivity to noise. zero axis is the center of the edge, which theoretically
Zhao Yu-qian et al. [11] proposed a novel mathematic allows us to measure edge location to sub-pixel
morphological algorithm to detect lungs CT medical accuracy. Sub-pixel accuracy refers to the fact that
image edge. They showed that this algorithm is more zero-crossing may be at fractional pixel distance.
efficient for medical image denoising and edge In the traditional edge detector, the gradient of image
detecting than the usually used template-based edge is calculated using first order deviation [13]. When
detection algorithms such as Laplacian of Gaussian the gradient is above the threshold, there is an object
operator and Sobel edge detector, and general in the image. As regarding to image f(x,y), the
morphological edge detection algorithm such as gradient of point (x,y) is defined as follows:
∂f ∂f
∇f ( x, y ) = ⎡G x Gy ⎤ =
morphological gradient operation and dilation residue
(1)
edge detector. Fesharaki, M.N.and Hellestrand, G.R ⎣⎢ ⎥⎦ ∂x ∂y
[12] presented a new edge detection algorithm based
on a statistical approach using the student t-test. They The weight of the vector is

[ ]
selected a 5x5 window and partitioned into eight 1
2 2 2
different orientations in order to detect edges. One of ∇f = mag (∇f ) = G x + G y (2)
the partitioning matched with the direction of the edge And its direction as
in the image shows the highest values for the defined
statistic in that algorithm. They show that this φ ( x, y ) = arctan(G y / G x ) (3)
method suppresses noise significantly with preserving Gradient of every pixel of the image is calculated
edges without a prior knowledge about the power of using the above three equations. In fact, small region
noise in the image. pattern convolution is used to process the image.
Gradient operators include Robert, Prewitt and Sobel
3- Edge detection operators operator. These operators have simplicity and detect
An edge operator is a neighborhood operation which the edges and their orientations but have an
determines the extent to which each pixel's inaccurate sensitivity to noise. On the other hand,
neighborhood can be partitioned by a simple arc Laplacian operator uses second derivative, the
passing through the pixel where pixels in the operator is defined as:
neighborhood on one side of the arc have one 2 2
2 ∂ f ( x, y ) ∂ f ( x, y )
predominant value and pixels in the neighborhood ∇ f ( x, y ) = + (4)
2 2
on the other side of the arc have a different ∂x ∂y
predominant value. Usually gradient operators, The Laplacian operator finding the correct places of
Laplacian operators, zero-crossing operators are used edge, testing wider areas around the pixel but
for edge detection. The gradient operators compute malfunctioning at corners, curves. Also and where
some quantity related to the magnitude of the slope of the gray level intensity function varies, not finding
the underlying image gray tone intensity surface of the orientation of edge because of using the
which the observed image pixel values are noisy Laplacian filter. Laplacian of Gaussian (LOG)

18
GVIP Journal, Volume 6, Issue 4, December, 2006

combined Gaussian filtering with the Laplacian and 4- Morphological Filtering


defined as: Morphology relates to structure or form of objects.
2 2 Morphological filtering simplified segmented images
1 x +y
Gδ ( x, y ) = exp( − ) (5) by smoothing out object outlines using filling small
2 2
2πδ 2δ holes, eliminating small projections. Primary
Using Convolution of Gaussian operator with operations are dilation and erosion. These operations
image f(x,y), the image is smoothed, then the edge use a structuring element which determines exactly
is detected using the following equation: how object will be dilated or eroded. Dilation
2
[ ] [ 2
]
∇ Gδ ( x, y ) * f ( x, y ) = ∇ Gδ ( x, y ) * f ( x, y )
process expanding image objects by changing pixels
with value of "0" to "1". On the other hand the
(6) erosion process shrinking binary objects by changing
Gaussian edge detectors are symmetric along the pixels with a value of "1" to "0". There is also a
edge, and reduce the noise by smoothing the image. combination of dilation and erosion called opening
The significant operators are Canny and Shen-Castan and closing. Opening is erosion followed by dilation.
which convolve the image with the derivative of Closing is a dilation followed by erosion.
Gaussian for Canny and Shen-Castan. The Canny Morphological edge detection algorithm selects
algorithm is an optimal edge detection method based appropriate structuring element of the processed
on a specific mathematical model for edges. The image makes use of the basic theory of morphology
edge model is a step edge corrupted by Gaussian including erosion, dilation, opening and closing
noise. The Canny edge detector was devised to be an operation and synthesization operations of them get
optimal edge detector, which satisfies all of the three clear image edge. The effect of erosion and dilation
performance criteria. The first criterion is to operations is better for image edge by performing the
minimize the situations of detecting false edges and difference between processed image and original
missing actual edges. The second criterion is to image, but they are worse for noise filtering. As
minimize the distance between the detected edges opposed to erosion and dilation, opening and closing
and actual edges. The third criterion is to minimize operations are better for filtering.
multiple responses to an actual edge, i.e. to ensure
there is only one response for an actual edge point.
Boie-Cox algorithm [14], is a generalization of the
5- Methods of the evaluation of
Canny algorithm using matched filters and Wiener performance for edge detectors
filters. The Shen-Casten algorithm [15], was There are two methods to evaluate the performance
developed as an optimal solution to a specific of edge detectors, subjective methods and objective
mathematical model. Shen and Castan claim that methods. Subjective methods borrowed from the
their filter does better than Canny at finding the field of psychology and use human judgment to
precise location of the edge pixel. The search evaluate the performance of edge detectors. More
includes steps similar to the Canny, but with precisely, these methods involve presenting a series
modifications and extensions. of edge images to several individuals and asking
them to assign scores on a given scale. Even if these
methods seem easy to put into practice, they have
3.2-Advantages and disadvantages of edge some drawbacks. The number of characteristics a
detectors human eye can distinguish is limited. For example,
The classical operator such as Sobel, and Prewitt the eye cannot differentiate between two gray levels
which uses first derivative has very simple that are slightly different. As well, the judgment
calculation to detect the edges and their orientations depends on the individual's experience and
but has inaccurate detection sensitivity in case of attachment to the method, as well as on the image
noise. Laplacian of Gaussian (LOG) operator is type (i.e., multi-spectra, X-ray). The subjective
represented as another type of edge detection measures are better than the objective measures for
operator which uses second derivative. It finds the image evaluation, if the goal is to achieve high-
correct places of edges and testing wider area around quality images as defined by our visual perception.
the pixel. The disadvantages of LOG operator is that Subjective measures can be classified into three
it can not find the orientation of edge because of categories. The first type is referred to as impairment
using the Laplacian filter. The other type of edge tests, where the test subjects score the images in
detection operator is the Gaussian edge detectors terms of how bad they are. The second type is
such as Canny, Shen Castan and Boie-Cox operators quality test, where the test subject rates the images in
which are using probability for finding error rate and terms of how good they are. The third type is called
localization. Also it is symmetric along the edge and comparison tests, where the images are evaluated on
reduces the noise by smoothing the image. So it is a side-by-side basis. The comparison type tests are
performs the better detection in noise condition but considered to provide the most useful results, as they
unfortunately it has complex computing. provide a relative measure, which is the easiest
metric for most people to determine. Impairment and
quality tests require an absolute measure, which is

19
GVIP Journal, Volume 6, Issue 4, December, 2006

more difficult to determine in an unbiased fashion. chosen as one of many possible images for use by the
Table(1) explains the subjective fidelity scoring research community. Lena image contains a nice
scales [16]. mixture of detail, flat regions, shading, and texture
that do a good job of testing various image
processing algorithms. The sample resultant images

Comparison
Impairment

from application of Boie-Cox, Shen-Castan, Canny,


LOG, Prewitt and Sobel operators were applied to a

Quality
Lena gray scale image with salt and pepper noise
with probability 0.1 for both salt and pepper. The
morphological filter is applied for a noisy image to
5-Impreceptible A-Excellent +2 much get a clear image before edge detection of noisy
better image. Opening-closing operation is firstly used as
4-Perceptible, B-Good +1 better preprocessing to filter noise. Then smooth the image
not annoying by first closing and then dilation. The perfect image
3-Somewhat C-Fair 0 the same edge will be got by performing the difference
annoying between the processed image by above process and
2-Severely D-Poor -1 worse image before dilation.
annoying The visual comparison of the resultant images can
1-Unusable E-Bad -2 much lead us to the subjective evaluation of the
worse performances of selected edge detectors. Figure (1)
Table (1) Subjective fidelity scoring scales shows the comparison between edge detection
operators with salt and pepper noise with probability
On the other hand, objective methods use to measure 0.1 for both salt and pepper without morphological
the performance of edge detectors using signal to filter. Figure (2) shows the comparison between
noise ratio and mean square error between the edge operators after morphological filter on the noisy
detectors images and the original one. The objective image with salt and pepper. The evaluating of edge
methods borrowed from digital signal processing and detection performance obeys the three important
information theory, and provide us with equations criteria. First, the edge detector should find all real
that can be used to measure the amount of error in a edges and not find any false edges. Second, the
processed image by comparison to known image. edges should be found in the correct place. Third,
Although the objective methods are widely used, are there should not be multiple edges found for a single
not necessarily correlated with our perception of edge. The same experiment done with Lena image is
image quality. For instance, an image with a low done with another grayscale image (256x256)
error as determined by an objective measure may designed by author as in figure (3-a). The original
actually look much worse than an image with a high ground truth (GT) image in figure (3-c) was
error metric. Commonly used objective measures are compared with the different edge detect operators for
the root-mean-square error, eRMS, the root-mean- the original grayscale noisy image without
square signal-to-noise ratio, SNRRMS, and the peak morphological filter as in figure (3) and with
signal-to-noise ratio, SNRPEAK as in equations (7), (8) morphological filter as in figure (4).
and (9) respectively. Objective methods are used in this experiment by
1 2 calculating signal to noise ratio peak and the root
eRMS = ∑ rM=−01 ∑cN=−01 [ E ( r , c ) − O ( r , c )] (7) mean square error between the edge detection images
MN
and the original ground truth image. Table (2-a,b)
shows the peak signal to noise ratio and the root
2 mean square error for different operators on noisy
∑ rM=−01 ∑cN=−01 [ E ( r , c )]
SNRRMS = (8) image before and after morphological filter is used.
2
∑ rM=−01 ∑ cN=−01 [ E ( r , c ) − O ( r , c )]
SNRPEAK SNRPEAK
Operators before after Morph.
2
(L − 1) Morph.
SNRPeak = 10log10 (9)
1 2 Sobel 2.123 8.377
∑rM=−01 ∑cN=−01[E(r, c) − O(r, c)] Prewitt 2.556 8.754
MN
LOG 5.825 10.164
Where O(r,c) is the original image, E(r,c) is the
Canny 7.145 10.193
reconstructed image and L is the number of gray
Shen-Castan 8.741 11.754
level equal to 256.
Boie-Cox 9.418 10.009
Table(2-a) shows SNRPEAK before and after
6- Experiment of Edge Detection Morphological filter.
In this paper image Lena (grayscale 256x256) which
digitized at the University of Southern California was

20
GVIP Journal, Volume 6, Issue 4, December, 2006

(a) Original image (b) Noisy image (c) Sobel (d) Prewitt

(e) LOG (f) Canny (g) Shen-Castan (h) Boie-Cox


Figure (1) shows the comparison between edge detection operators with salt and pepper noise without
morphological filter.

(a) Noisy image (b) Morphological Filter (c)Prewitt (d) Sobel

(e) LOG (f) Canny (g) Shen-Castan (h) Boie-Cox


Figure (2) shows the comparison between operators after morphological filter on the noisy image with salt
and pepper after morphological filter.

(a) Original (b) Noisy image (c) Original (d) Sobel (e) Prewitt
image GT image

(f) LOG (g) Canny (h) Shen-Castan (i) Boie-Cox


Figure (3) shows the comparison between edge detection operators with salt and pepper noise used an
original image ground truth without morphological filter.

21
GVIP Journal, Volume 6, Issue 4, December, 2006

(a) Noisy image (b) (c) Original GT (d) Sobel (e) Prewitt
Morphological image
Filter

(f) LOG (g) Canny (h) Shen-Castan (i) Boie-Cox


Figure (4) shows the comparison between edge detection operators with salt and pepper noise used an
original image ground truth after morphological filter.

eRMS eRMS Castan are less than LOG, while LOG less than Sobel
Operators before after and Prewitt. On the other hand the Single to Noise
Morph. Morph. Ratio Peak for Canny, Boie-Cox and Shen-Castan are
Sobel 199.707 97.206 greater than LOG, while LOG is greater than Sobel
Prewitt 189.994 93.007 and Prewitt in case of noisy image. After
LOG 130.408 79.126 morphological filter the peak signal to noise ratio
Canny 112.023 78.870 increases for all edge detector operators while the root
Shen-Castan 93.217 65.895 mean square error decreases. The peak signal to noise
Boie-Cox 85.450 80.558 ratio and the root mean square error in LOG operator
Table(2-b) shows eRMS before and after and Canny operator are nearly the same after
Morphological filter. morphological filter. It means that the subjective and
objective evaluations are reliable.
This paper concludes that the subjective and objective
7- Discussion and conclusion evaluations of noisy image shows that Boie-Cox,
In this paper, subjective evaluation of edge detection Shen-Castan, Canny, LOG, Prewitt, and Sobel exhibit
result images show that Boie-Cox, Shen-Castan, better performances respectively. This is because the
Canny, LOG, Prewitt, and Sobel exhibit better Gaussian edge detectors are symmetric along the edge
performances respectively under noisy conditions. and reduce the noise by smoothing the image. Also, it
This is due to the Gaussian operators such as Canny concludes that the morphological filter is more
and Shen- Castan operators using probability for important as an initial process in the edge detection for
finding error rate, localization and response. noisy image.
According to table (1) in case of noisy image with salt
and pepper with probability 0.1 without morphological
filter, the Prewitt and Sobel have poor quality. 8 - References
Laplacian of Gaussian has fair quality, and Canny, [1] Canny, J., "A Computational Approach to Edge
Shen-Castan and Boie-Cox have a good quality. After Detector", IEEE Transactions on PAMI, pp679-
morphological filter the Prewitt and Sobel have fair 698, 1986.
quality. Shen-Castan, Boie-Cox and Canny have good [2] Bovik, A. C., Huaung, T. S. and JR. D. C. M.,
quality. Shen-Castan, Boie-Cox and Canny are more "Non-parametric tests for edge detection noise",
acceptable than LOG, while LOG is more acceptable Pattern Recognition, 19:209-219, 1986.
than Prewitt, and Sobel in case of noisy image without [3] Yakimovsky Y., "Boundary and object detection
morphological filter. Boie-Cox, Shen-Castan, Canny in real world image", Journal ACM, 23:599-618,
and LOG are better than Prewitt and Sobel in case of 1976.
noisy image after morphological filter. The objective [4] Raman Maini and J. S. Sobel, "Performance
evaluation of edge detection results as in table (2-a,b) Evaluation of Prewitt Edge Detector for Noisy
agree the subjective evaluation that the Shen-Castan, Images", GVIP Journal, Vol. 6, Issue 3,
Boie-Cox and Canny operators are better than LOG, December 2006. www.icgst.com
Prewitt and Sobel in case of noisy image. The root [5] Davis, L. S., "Edge detection techniques",
mean square error of Canny, Boie-Cox and Shen- Computer Graphics Image Process. (4), 248-270,
1995.

22
GVIP Journal, Volume 6, Issue 4, December, 2006

[6] Sharifi, M.; Fathy, M.; Mahmoudi, M.T.; " A Symposium on Volume 2, Page(s):1280 – 1283,
classified and comparative study of edge 12-14 Oct. 2005.
detection algorithms", International Conference [11] Zhao Yu-qian; Gui Wei-hua; Chen Zhen-cheng;
on Information Technology: Coding and Tang Jing-tian; Li Ling-yun; "Medical Images
Computing, Proceedings, Page(s):117 – 120, 8- Edge Detection Based on Mathematical
10 April 2002. Morphology" Engineering in Medicine and
[7] Shin, M.C.; Goldgof, D.B.; Bowyer, K.W.; Biology Society, IEEE-EMBS. 27th Annual
Nikiforou, S.; " Comparison of edge detection International Conference, Page(s):6492 – 6495,
algorithms using a structure from motion task", 01-04 Sept. 2005.
Systems, Man and Cybernetics, Part B, IEEE [12] Fesharaki, M.N.; Hellestrand, G.R.; "A new edge
Transactions on Volume 31, Issue 4, detection algorithm based on a statistical
Page(s):589-601, Aug. 2001. approach", Speech, Image Processing and Neural
[8] Heath M. , Sarker S., Sanocki T. and Bowyer K.," Networks, Proceedings, ISSIPNN '94.,
Comparison of Edge Detectors: A International Symposium, Page(s):21 - 24 vol.1,
Methodology and Initial Study", Proceedings of 13-16 April 1994.
CVPR'96 IEEE Computer Society Conference on [13] Gonzalez , R and Woods, R., "Digital Image
Computer Vision and Pattern Recognition, Processing" 2/E, Prentice Hall Publisher, 2002.
pp.143-148, 1996. [14] Cox, I.J.; Boie, R.A.; Wallach, D.A.; "Line
[9] Rital, S.; Bretto, A.; Cherifi, H.; Aboutajdine, D.; recognition", Pattern Recognition Proceedings.,
"A combinatorial edge detection algorithm on 10th International Conference on Volume i,
noisy images", Video/Image Processing and Page(s):639 - 645 vol.1, June 1990.
Multimedia Communications 4th EURASIP- [15] Castan, S.; Zhao, J. and Shen, J." New edge
IEEE Region 8 International Symposium on detection methods based on exponential filter",
VIPromCom, Page(s):351 – 355, 16-19 June Pattern Recognition, Proceedings 10th
2002. International Conference on Volume i, Issue 16-
[10] Li Dong Zhang; Du Yan Bi; "An improved Page(s):709 - 711, vol.1, Jun 1990.
morphological gradient edge detection [16] Umbaugh, S. , "Computer Imaging: digital image
algorithm", Communications and Information analysis and processing", CRC press book, 2005.
Technology, ISCIT 2005. IEEE International

23

View publication stats

You might also like