You are on page 1of 4

2011 4th International Congress on Image and Signal Processing

An Improved Prewitt Algorithm for Edge


Detection Based on Noised Image
Lei Yang

Dewei Zhao

Digital Media Department. Communication University

Digital Media Department. Communication University

of China

of China

Beijing, China

Beijing, China

young-lad@263.net

zhaodewei0126@126.com

Xiaoyu Wu

Hui Li

Digital Media Department. Communication University

Digital Media Department. Communication University

of China

of China

Beijing, China

Beijing, China

xiaoyu.wu09@gmail.com

lihui_1209@126.com

Jun Zhai
Digital Media Department. Communication University
of China
Beijing, China
pollo3@sohu.com

Abstract- In this paper ,an improved Prewitt algorithm for

Again, an 8-neighborhood template is proposed to remove the

edge detection is proposed for the reason that the traditional

isolated single pixel noise. The experimental results show that

Prewitt edge detection algorithm is sensitive to the noise. The

the improved algorithm improves the anti noise performance

traditional Prewitt edge detection operator only has two

greatly, and detects the edges of the random noised image

templates with horizontal and vertical directions. While the

effectively.

edge is in a plurality of directions, so operator with eight


templates of different directions is put forward and it can
detect more edges. In order to improve the capability of

Keywords-Prewitt; edge detection; OTSU automatic threshold;


eight-neighborhood denoising

resisting noise, this paper put forward three improvements.

I. INTRODUCTION

First of all, the mean value rather than the maximum value of
the gradient magnitude of the eight directions is used as the
final

gradient

magnitude.

Secondly,

OTSU

automatic

threshold is used to set the gradient magnitude threshold.

978-1-4244-9306-7/11/$26.00 2011 IEEE

Edge detection is the basic of image segmentation and


recognition, which occupies a very important position in
engineering application. The various existing algorithms of
edge detection do not have the absolute advantages. When

1197

an algorithm has advantages on one hand, it may have some

The traditional algorithm calculates the eight directions

defects on another hand as described in [1]. Prewitt operator

gradient of each point in image, then take the maximum

has the advantages like simple, fast processing speed,

value of eight gradient magnitudes as the pixel value of the

relatively smooth and continuous edge, while it has the

edge image in corresponding point, generally do not set the

disadvantage of sensitive to noise. An Prewitt algorithm[2]

threshold, and it is very sensitive to noise.

for edge detection based on OTSU threshold value is

III. THE IMPROVED PREWITT ALGORITHM

proposed in research, and the edge image is denoising by an


eight neighborhood window. The results prove that the

A. Gradient Value Method


The original 8-direction Prewitt algorithm takes the

algorithm is effective in processing the random noised

maximum value of the 8 gradient amplitude values as the

images.
II. THE TRADITIONAL PREWITT ALGORITHM
The traditional Prewitt operator for edge detection
contains two groups of 3 3 matrix. It can only detect the
horizontal and vertical directions, but the edge has more
than one directions. In order to detect more edge directions,
a Prewitt operator template of eight directions is proposed, it

gradient amplitude value of the point. But this paper adopts


the mean value of them as the gradient magnitude of the
point ( for each two reverse gradient amplitude value are
opposite number, the average value is an average of four
absolute values of the gradient magnitude[4]). This gradient
value method can reduce the effect of noise, and make the
edge more smooth and continuous.

means that six templates of different directions are added to


the original two templates. 8- direction operator templates[3]

B. Automatic Thresholding method


Generally, there is no threshold for the traditional

is shown in Fig.1( Figure is abbreviated as Fig).

Prewitt edge detection algorithm, and the value of gradient


magnitude is taken as the pixel value of the edge image, so
that not only the noise resisting ability is not good, but also
false edges will be detected. So it is very important to select
a suitable threshold for the gradient magnitude value. Too
high threshold will make the edge uncontinuous, and the
edge information lost, while too low threshold will make the
edge thicker, and the false edges will appear. Two kinds of
automatic acquisition of threshold methods[5] are used in
this paper. One is an adaptive threshold using the average of
8 neighborhood gray values as one of the gradient
magnitude threshold parameters[6]. This method is that, for
each pixel, k times of the average of its eight neighborhood
pixel gray values is taken as the gradient threshold of this
pixel. The other is using k times of OTSU automatic
Fig.1 8 templates of different directions

threshold as one of the gradient magnitude threshold

1198

parameters. OTSU automatic threshold is a kind threshold

C. The 8-neighborhood Denoising

when the between-cluster variance reaches a maximum


Generally, edge is continuous, and the isolated

value. The principle of OTSU has been described in many

individual pixel is taken as the noise. In order to remove

textbooks such as in [7].


If the total number of the image pixels is N, gray scale

isolated single pixel noise of the edge image, an

range is [0,L-1], Divide the gray values of these pixeles into

8-neighborhood window is used. For each pixel, if its gray

C1 , C0 represents those pixels

value is not zero, then calculate the non-zero pixel gray

C1 represents
those in [T,L-1]. The probability of C0 and C1
respectively is w0 and w1 . u 0 and u1 are the mean
value of C0 and C1 , and the mean of the gray value of

value number n of its 8 neighborhood. if n equals 0, then the

two categories C0 and

whose gray-scale values in [0, T-1], while

the entire image pixels is

pixel is an isolated point, it will be taken as a noise point


and its gray value will be set to 0.
IV. THE EXPERIMENT RESULTS AND ANALYSIS

u . Define 2 as the class

In the experiment, Fig.2 and Fig.3 are two images

variance, and its formula is as follows:

without noise. we get Fig.4 and Fig.5 by adding random

2 = w0 (u0 u ) 2 + w1 (u1 u )2

(1)

noises to Fig.2 and Fig.3 .

= w0 w1 (u0 u1 ) 2
T is the optimal threshold when

reaches the

maximum value. All above is the principle of OTSU


threshold.
We do not directly use the OTSU threshold T as the
gradient magnitude threshold, but use the T multiplied by a

Fig.2

The original image1

Fig.3

The original image2

constant k as the final threshold to get better edges. That is


the optimal threshold

To has the following equation:

To = T k

(2)

The results of the experiment shows that the effect is


best when k (0.25,0.45) . It also proves that OTSU
threshold method is better than the adaptive threshold
method. That is because OTSU method considers the overall
image changes, while the traditional method only considers
8

neighborhood

informations[8].

conditions

and

lost

some

edge

Fig.4 Image1with random noise

Fig.5 Image2 with random noise

We have Fig. 6 and Fig. 7 when Fig. 4 and Fig. 5 are


processed by original Prewitt algorithm,which chooses the
maximum value of the 8 direction gradient amplitudes as the
edge image pixel value. Fig.8 and Fig.9 adopt the mean
value instead of the maximum.

1199

V. CONCLUSION

In this paper, the original 8-direction Prewitt


algorithm is improved for its poor anti-noise performance.
Firstly, it takes the mean value of the 8-direction gradient
magnitudes as the gradient magnitude value. Secondly, it
adopts k times of the OTSU automatic threshold as the
Fig.6 The original Prewitt Algorithm

Fig.7 The original Prewitt Algorithm

gradient magnitude threshold. Thirdly, the isolated single


pixel noise of the edge image is eliminated by an
8-neighborhood window. The results of the experiment
show that this algorithm is suitable for the edge detection
with random noise of an image. The next work is to find
a more efficient automatic threshold and a more effective
denoising methodto detect edges better [9].

Fig.8 The mean value algorithm

Fig.9 The mean value algorithm

ACKNOWLEDGMENT
There are some differences between the results of Fig.8

This work is supported by the 211 Key Subject

and Fig. 6 as well as the results of Fig.9 and Fig.7. The edge

Construction Project of Communication University of

is more delicate, smooth and continuous in Fig.8 and Fig.9,

China.

and the noise is inhibited to some extent. This is because the


average has a smoothing effect, and the noise is also
weakened at the same time. We get Fig.10 and Fig.11 after
processing Fig.4 and Fig.5 using the complete improved
algorithm described in this article. Comparing Fig.5 with
Fig.6, it is obvious that the edge is more smooth and

REFERENCES
[1]
[2]
[3]

[4]

continuous ,and the random noise is significantly reduced in


Fig.10 and Fig.11. So we draw a conclusion that the
improved algorithm is better than the original algorithm.

[5]

[6]

[7]

[8]
[9]

Fig.10 improved algorithm result

Fig.11 improved algorithm result

1200

X L. Ci and G. G. Chen, Analysis and Research of Image Edge


Detection Methods, Journal of Infrared, pp. 20-23, JuL 2008.
Wilhelm Burger,Digital image processing: Java language description
of the algorithm,Tsinghua University Press,Beijing,Jan. 2010.
Na Chang,Image Processing Research on edge detection
algorithm,China Sience And Technology Information, Feb.2011, (in
Chinese).
Yao Lang, An improved Sobel edge detection operator,Computer and
information technology,2011(5):59~60, (in Chinese).
Otsu N.A. Threshold Selection Method from Gray Level
Histograms,IEEE Trans on Systems. Man and Cybernetics, SMC
-9,1979,9(1):62-66.
Wang Haifeng, Zhou Genyuan, Zhang Yi, Research on Edge
Detection and Thinning Algorithm of Improved Prewitt about
Dynamic Threshold, Coal Technology, Vol.28, No.08, pp.144-145,
Aug,2009.
Haibo Liu,Jing Shen,Song Guo,Digital Image Processing Using
Visual C++,China Machine Press,Beijing,2010,pp.290~296,(in
Chinese).
Gonzalez R.C., Woods R.E., "Digital Image Processing", Addison
Wesley, 2002.
Chunxi Ma, Lei Yang, Wenshuo Gao, An Improved Sobel
Algorithm Based on Median Filter, International Conference on
Mechanical and Electronics Engineering,2010(1):88~92.

You might also like