You are on page 1of 3

EDGE DETECTION BY GENETIC ALGORITHM

M. K. Lee*, S, W. Leung**, T, L. Pun and H. L. Cheung


*Alex.M.K.Lee @plink.cityu.edu.hk
**eeswl @cityu.edu.hk
Department of Electronic Engineering,
City University of Hong Kong,
Hong Kong, China
ABSTRACT
This paper presents a novel edge detection method based
on Genetic Algorithm (CA). Only a simple image data
set is required for constructing the edge filter. The data
set, which consists of a simple image and its expected
edge features, is used for training by the GA. The merit
of this method is that an effective edge extraction filter
can be easily constructed. Results and examples are
illustrated in the paper.

j=l

to represent the required edge information - edge


feature. Different coefficients, w,(n),represent different
edge filter characteristics. This paper presents new edge
detection method which constructs the edge filter by
optimising the coefficients, w,{n), directly using a CA
learning alorigthm.
The schematic diagram of the proposed edge
detection method is illustrated in Figure 1. The input of
the algorithm consists of two images. One is a simple
image and the other its corresponding edge image such
as those shown in Figure 2. These two images are used
as the input in the CA training algorithm for optimizing
the coefficients, w,(n). The trained filter is then applied
to other images for edge detection; results are illustrated
in later sections.

1. INTRODUCTION
Laplacian and Sobel [ 13 are classical mathematical
methods for edge detection. The Laplacian Edge
Detection method uses a two-dimensional linear filter to
approximate the 2"dorder derivative of pixel values of
the image. The Sobel edge detection method uses two
two-dimensional linear filters to process vertical edges
and horizontal edges separately. In general, these
classical methods utilize linear function of the form

with edge

Image

feature
(i) input image

(ii) input edge image

Figure 2: Training Set 'Circle'


2. GA TRAINING ALGORITHM
Applied
Image

-b

Trained
Filter -b

Result
Image

A simple genetic algorithm [3] is used here to optimize


the coefficients, wi(n), of the edge detection filter. All
the coefficients are converted into bit format and
combined into bit array called chromosomes, the
fundamental elements of the GA method.
For the fitness calculation, chromosomes are
converted back to filter coefficients and applied to the

47 8
0-7803-6297-7100/$10.00 0 2000 IEEE

training image. A resultant edge image can be formed.


This image is then compared with the input edge feature
image to calculate the fitness value for similarity. Those
two binary images is compared pixel by pixel. When
two pixels from the resultant image and the input edge
feature image in the same coordinate are the same, the
fitness value of that chromosome will be increased by
one; otherwise, the fitness value will be decreased by
one.
The utility operations defined in the edge detection
GA algorithm are as follows:
Selection : Fitness-proportional selection-The
chromosome with minimum fitness
value and another randomly chosen
chromosome are selected from the
parent pool to process crossover and
mutation.
Crossover : three-point crossover to speed up the
processing time.
Mutation : classical GA mutation by randomly
flipping some of the bits in a
chromosome.
3. THRESHOLDING
An edge always occurs when there is a large difference
between values of neighbouring pixels, i.e. a sharp
change in grayscale level. A threshold, based on the
distribution of the grayscale level, is introduced in the
GA training algorithm for controlling the detection
sensitivity of the edge filter. This thresholding performs

edge sharpening and the edges extracted are one pixel in


width.
The concept is to consider the rate of change of pixel
intensity of edge feature. In fact, the trained edge
extraction filter can extract edge features of image. And
the rate of change of edge feature can be obtained, by
simple difference equations:
horizontal:

d ( x , Y) e(x, Y ) - e(x, Y - 1 )
vertical:

d(x,y)= e(x,y)-e(x-l,y)
where e(x, y ) is the intensity of the edge feature image in
pixel at row x and column y and d(x, y ) is the intensity of
the rate of change of edge feature in pixel at row x and
column y. When the value of a center pixel exceeds the
value of both the previous pixel and the following pixel,
either vertically or horizontally, there is a sharp change.
In addition, when this center pixel is larger than
threshold, it is classified as an edge.

4. RESULTS DISCUSSION
The result of the proposed method is compared with
classic methods, the Laplacian algorithm, the Sobel filter,
and the Canny-Deriche method. Since the output from
the Laplacian algorithm and the Sobel filter are in grey
level, a simple one-level quantization to edge or not edge
is applied for comparison purpose.
Figure 3 illustrates original images of House and
Peppers, and results of the proposed CA Edge

LaDlacian

Sobel

Cannv

eppers; Second Row


edge detection with training set Circle;Third Column - Laplacian method; Fourth Column - Sobel $iter; Fifth
Column - Canny edge detection.

479

Detection method, the Laplacian method, the Sobel


method and Canny edge detection method. The simple
training set, Circle (Figure 2), is input to the GA
training algorithm to optimize the filter coefficients,
w,{n). This demonstrates that the GA learning algorithm
is able to extract an edge using even a simple training
set. In the resultant image House obtained by the
Laplacian filter, there are many edge points which are
noisy particularly in the area of the wall. Results of
the proposed GA edge detection illustrate the capability
of noise reduction. By observing results of the applied
image Pepper, the Laplacian filter is found to be too
sensitive to noise. Although it can be improved by
considering the variance [ 13, calculation complexity
increases and the noise nearby the real edge still cannot
be removed. The Sobel filter works better in such noisy
situations but fails to extract edges with one pixel width.
This is illustrated in Figure 3.
The proposed GA edge detection is also compared
with an optimized edge detection method, the Canny
edge detector [2]. As shown in Figure 3, the result of the
Canny edge detection is better. Its edges are continuous
due to the used hysteresis thresholding. This is a kind of
contouring, using two-level thresholding and tracing of
possible edge paths. However, the proposed method uses
only a simple one-level thresholding technique.
Hysteresis thresholding may be the further works for
enhancement.
According to the, results of both the proposed
method and the Canny edge detection in Figure 4, we can
find that the performance of Canny degrade at the
corners of the rectangle, the corners become round, but
the proposed method does not. Smoothing corners is
because the first step of Canny edge detection is to
convolve the image with a gaussian filter. This filter is
like a smoother so the corners of the rectangle become
round.

is also included. Results so far indicate that GA


algorithm performs well compared to both the Sobel and
Laplacian algorithms, and provides a method which can
simply and easily construct an effective edge extraction
filter.

6. REFERENCES
[l] Jan S. Lim, Two-Dimensional Signal and Image
Processing, Prentice Hall, 1990, pp.476 - 494.

[2] Canny, J.F. A Computational Approach to Edge


Detection. IEEE Transactions on Pattern Analysis
and Machine Intelligence. 1986,8(6) pp.679-698.

[3] Melanie Mitchell, An introduction to genetic


algorithm, Massachusett, 1996.
[4] Tzay Y. Young, King-Sun Fu, R. Nevatia,
Handbook of Pattern Recognition and Image
Processing, Academic Press, 1986, pp.215-222.
[5] James C. Bezdek, Ramachandran Chandrasekhar,
Yianni Attikiouzel, A Geometric Approach to Edge
Detection, IEEE Transactions on Fuzzy systems,
1998, pp.52-72.
[6] Ch. Hafner and J. Frohlich, Generalized Genetic
Programming for Solving Engineering Problems,
Proc. PIERS Symposium, (Boston), p. 672, July
1997.

(i) Result of Canny


(ii) Result of GA
Figure 4: Edge images

5. CONCLUSION
This paper has presented an edge detection method based
on Genetic Algorithm (GA). Results and examples of
the algorithm are compared with those of the Sobel and
Laplacian algorithms; the Canny Edge Detection method
480

You might also like