0% found this document useful (0 votes)
3 views

Laplacian Edge Detection Algorithm for Road Signal

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Laplacian Edge Detection Algorithm for Road Signal

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

International Journal of Machine Learning and Computing, Vol. 9, No.

1, February 2019

Laplacian Edge Detection Algorithm for Road Signal


Images and FPGA Implementation
Issam Bouganssa, Mohamed Sbihi, and Mounia Zaim

 characterizing road signs, proposes methods based on the


Abstract—The applications of image processing for road variation of the intensity in the time domain by calculating
safety, detecting panels and roadway have attracted the Laplacian, which will be followed by a judicious
considerable attention in literature and research, especially in thresholding, the latter allows to isolate the contours of the
the field of information processing on embedded systems.
However, the demanding nature of image processing algorithms
rest of the image [1].
conveys a substantial burden for any conventional real-time The proposed algorithms are implemented in real-time on
implementation. Meanwhile, the emergence of reconfigurable a Xilinx Spartan-6 FPGA programmable circuit, which
architectures, especially FPGA chips, which have been given provides the performance needed for processing real-time
many facilities for rapid prototyping, where an image image sequences, while maintaining the flexibility of the
processing algorithm, can be designed, tested, and synthesized system to support an adaptive algorithm.
in a relatively short period of time compared to conventional or We start our work with the characteristics and the principle
traditional approaches. This paper studies a hardware and
software combination to obtain an optimal solution for the edge
of Edge detection, then we present the algorithms based on
detection, this step is considered essential for the detection of the gradient and Laplacian computation for contour
panels and roadways, the dedicated algorithm is based on the extraction in the road images, after we sit the different
Laplacian calculation for Edges detecting and implemented in a hardware software solutions for implementation of these
Xilinx Spartan 6 FPGA, and the results are displayed by algorithms on reconfigurable FPGA circuits. Finally, we
standing in a VGA monitor, with a sync and display controller. expose the results and discussions of the implementation and
a conclusion at the end of our work.
Index Terms—Edge detection, Laplacian, real time, FPGA.

II. CHARACTERISTICS OF CONTOURS IN ROAD SIGNAL


I. INTRODUCTION
IMAGES
An outline is materialized by a sudden change in intensity,
As well as the visual characteristics of color and texture,
and the goal of edge detection is to produce something like a
contours also have their peculiarities, to predict which
line drawing of an image. In the application of edge detection
detector will be the most effective [2]. In order to estimate the
algorithms we will look for places in the image where the
efficiency of the detectors, we will refer to some errors
intensity changes rapidly. In general, object boundaries tend
encountered when detecting contours (Perfect contour Fig.
to produce sudden changes in the intensity of the image.
1a):
For example, different objects are usually different colors
 Omission of certain pixels on the contour to be detected. It
or hues and this causes the image intensity to change as we
is measured by counting the number of forgotten pixels
move from one object to another. In addition, different
with respect to the total number of pixels of the ideal
surfaces of an object receive different amounts of light,
contour (Fig. 1b).
which again produces intensity changes. Thus, much of the
 Multiple responses by detecting multiple contours. It is
geometric information that would be conveyed in a line
measured by counting the number of ambiguous pixels
drawing is captured by the intensity changes in an image.
compared to those that are not ambiguous (Fig. 1d).
Unfortunately, there are also a large number of intensity
 Location: this error occurs when a pixel of an
changes that are not due to geometry, such as surface
unambiguous ideal outline is not in the right place. It is
markings, texture, and specular reflections. Moreover there
measured by counting the total distance between the
are sometimes surface boundaries that do not produce very
detected contour and the ideal contour (Fig. 1c).
strong intensity changes. Therefore the intensity boundary
 Sensitivity: This error is often related to noise and
information that we extract from an image will tend to
corresponds to false contours detected near the ideal
indicate object boundaries, but not always. The detected
contour. It is measured by counting the number of false
edges are materialized by the intensity break down in the
contours and the total number of contours detected (Fig.
image in a given direction. Several methods exist to detect the
1e).
break. Some of them are more or less complex.
In this work, for the safety and processing of road images,
the contour detection step, which is essential for

Manuscript received May 24, 2018; revised October 29, 2018.


The authors are with Laboratory LASTIMI, High School of Technology
SALE Mohammed V University, Rabat, Morocco (e-mail: a b c d e
[email protected], [email protected], Fig. 1. Examples of contour errors; a: ideal contour; b: omission; c:
[email protected]). relocation; d: multiple responses; e: sensitivity.

doi: 10.18178/ijmlc.2019.9.1.765 57
International Journal of Machine Learning and Computing, Vol. 9, No. 1, February 2019

In the image, a contour can be considered in different ways. The equation can be written:
Here we describe three main ways to consider a contour:
First, a contour can be seen as an abrupt change in the 𝛻 2 ƒ = 𝛻𝑥 (𝑓(𝑥 + 1, 𝑦) − 𝑓(𝑥, 𝑦))
intensity of the image particularly for images in gray level [3].
Secondly, a way very similar to that mentioned above, to
+𝛻𝑦 (𝑓(𝑥, 𝑦 + 1) − 𝑓(𝑥, 𝑦)) (5)
consider the contour as a difference on color. Thirdly, if we
Now we can define the Laplacian (Ox) by:
consider the image as a 2D signal, we can go in the frequency
domain (Fourier transform or wavelet for example) [4]. In
this case, a contour can be represented as the high frequency 𝛻𝑥 (𝑓(𝑥 + 1, 𝑦) − 𝑓(𝑥, 𝑦)) = 𝑓(𝑥 + 1, 𝑦) −
signal. 𝑓(𝑥, 𝑦) − (𝑓(𝑥, 𝑦) − 𝑓(𝑥 − 1, 𝑦)) (6)

III. EDGE DETECTION PRINCIPLE WITH THE ALGORITHMS OF


𝛻𝑥 (𝑓(𝑥 + 1, 𝑦) − 𝑓(𝑥, 𝑦)) = 𝑓(𝑥 + 1, 𝑦) +
GRADIENT AND LAPLACIAN 𝑓(𝑥 − 1, 𝑦) − 2𝑓(𝑥, 𝑦) (7)
A local variation of intensity is a primary source of
information in image processing. It’s measured by the And we define the Laplacian (Oy) by:
gradient [3] vector function of the pixel [i, j].
𝛻𝑦 (𝑓(𝑥, 𝑦 + 1) − 𝑓(𝑥, 𝑦)) = 𝑓(𝑥, 𝑦 + 1) −
A. The Gradient of an Image
In an orthogonal coordinate system (Oxy) where (Ox) is 𝑓(𝑥, 𝑦) − (𝑓(𝑥, 𝑦) − 𝑓(𝑥, 𝑦 − 1)) (8)
the horizontal axis and (Oy) the vertical axis, the image
gradient (or rather the luminance f) at any point or pixel 𝛻𝑦 (𝑓(𝑥, 𝑦 + 1) − 𝑓(𝑥, 𝑦)) = 𝑓(𝑥, 𝑦 + 1) +
coordinates (x, y) [3], [4] is denoted by Equation 1:
𝑓(𝑥, 𝑦 − 1) − 2𝑓(𝑥, 𝑦) (9)
𝜕ƒ

 𝐺𝑟𝑎𝑑 ƒ = 𝜵 ƒ = (
𝜕𝑥
𝜕ƒ ) (1) So the Laplacian (Oxy) can be written:
𝜕𝑦
 𝛻 2 ƒ = 𝑓(𝑥 + 1, 𝑦) + 𝑓(𝑥 − 1, 𝑦) + 𝑓(𝑥, 𝑦 + 1)
The module of the gradient quantifies the importance of +𝑓(𝑥, 𝑦 − 1) − 4𝑓(𝑥, 𝑦) (10)
the contour highlighted, that is to say the magnitude of the
jump intensity observed in the image:
This Laplacian calculation operation can then be applied to
an image via filtering with the following mask 3 * 3:
𝜕 ƒ2 𝜕 ƒ2
ǁ𝛻ƒǁ = √( )+( )(2)
𝜕𝑥 𝜕𝑦

The direction ⍺ₒ of the gradient determines the present
edge in the image. Indeed, the gradient direction is
orthogonal to that of the outline:
Other masks can be used for the application of the
⍺ₒ = arctan(
𝜕 ƒ/𝜕𝑦
)(3) Laplacian algorithm:
𝜕 ƒ/𝜕𝑥

The principle of edge detection by the use of the gradient is
to calculate, in the first time, the gradient of the image in two
orthogonal directions, then the gradient module. The next
step is to make a selection of the most marked contours, that
is to say the points of stronger contrast with adequate After filtering the image by means of one of these filters, it
thresholding. is necessary to detect the zero crossings while keeping only
the most marked passages. Indeed, the technique is
B. Laplacian Mask with Second Derivative particularly sensitive to noise due to the double derivation. It
The gradient operators seen above exploit the fact that a is therefore a question of not considering the noise, which can
contour in an image corresponds to the maximum of the very well result in oscillations around zero, like an edge.
gradient in the direction orthogonal to the contour. It is the role of the threshold S which will be used in this
However, the zero crossing of the second derivative of an approach to take into account only the relatively high
intensity break also makes it possible to highlight the contour amplitude zero crossings corresponding to true Edge of the
[5]. image.
The second derivative is therefore determined by the The difference between the methods presented in this
Laplacian calculation: article and the classical edge detection such as Sobel, Prewitt
and Robert, is that the classical masks are codes in several
( ) + 𝜕𝑦 (𝜕𝑦) (4)
𝜕²𝑓 𝜕²𝑓 𝜕 𝜕𝑓 𝜕 𝜕𝑓
𝛻² ƒ = 𝜕𝑥² + = directions (vertical, horizontal, diagonal) and a module
𝜕𝑦² 𝜕𝑥 𝜕𝑥
 calculus of these directions is obligator, to have a single

58
International Journal of Machine Learning and Computing, Vol. 9, No. 1, February 2019

image that presents the edges. disadvantage is its sensitivity to the acoustic noise of the
The mask present in this document is applied only one second derivative. However, the results are often quite broad.
liver and presents the different edge of the image. The filters based on the calculation of the variation of the
intensity, which it is by the first or second derivative are the
C. Thresholding
most used in the industrial applications requiring constraints
The previous methods of Laplacian algorithms were used for the implementation in real time on an embedded system.
to determine the double derivation of the image that allows
effectively highlighting these contours. At this level, the
resulting image is expressed in gray levels, indicating here IV. HARDWARE SOFTWARE TOOLS NEEDED FOR ROAD
the importance of each fracture intensity [6]. IMAGES PROCESSING
To isolate the edges of the rest of the image, a new step is
Real-time image processing requires high computing
needed to obtain more accurate information that can test the
power. For example, the standard image.jpg is about 0.8
presence of edges. The resultant image IB (i, j) of this
megapixels per frame, with a calculated power of 30 frames
treatment is in black and white. White pixels (value 1)
per second for a 25 MHz processor.
indicate the presence of an edge, the absence of black pixels
The size of the image may be larger [7], the amount of
(value 0).
processing required per pixel also depends on the processing
The conversion of a gray-scale image to a black-and-white
algorithm used.
'binarization' image after the Laplacian filter IM (i, j) image,
High resolution images become more common, processing
requires the setting of the thresholding and the determining of
requirements will increase. High resolution images of
a threshold value to represent the edges more signified and
standards typically have ten times more pixels per image. The
avoids the edges of the noisy.
computing load is about ten times higher. They require more
This parameter, noted S, is chosen to present the most
DSP or a very expensive high-end DSP. In this scenario,
significant contours found from a cumulative histogram of
FPGAs provide real-time alternative image processing.
the image at the gray level. If the value of the image pixel
FPGA effectively supports high levels of parallel processing
exceeds the threshold, the resulting pixel value is 1. data stream structures, which are important for the efficient
Otherwise, the pixel value is set to 0: implementation of image processing algorithms.

IB (i ,j ) = 1 if IM (i ,j ) ≥ S A. Xilinx ISE
Else IB (i ,j ) = 0  ISE is an integrated digital system development
environment aimed at FPGA hardware synthesis /
implementation. Designs can be described in three main
forms: as diagrams, as HDL or as state diagrams (Fig. 3).
D. Simulation of the Laplacian Algorithm on Different
Road Images For this, ISE integrates various tools to pass through the
entire design flow of a digital system. It includes editors and
We present in this part, the application of mask based on tools for system input, as well as a set of tools, synthesis and
the calculation of Laplacian on different road images, the
implementation, grouped into a single design flow [7]. The
goal being to verify the effectiveness of the mask to give
details of these tools are given as follows:
optimal results for the detection of the edges.  Design Entry: HDL Editor, Finite State Machine Editor
(State CAD), Engineering Capture System (ECS), and IP
Generator (CORE Generator).
 Synthesis: XST (Xilinx Synthesis Technology), Leonardo
Spectrum by Mentor Graphics and Synplify by Cadence.
 Simulation: Test Bench HDL Generator and Model
Technology ModelSim simulator integration.
 Implementation: Translate MAP, placement and routing
(PAR), floor planner, FPGA editor, timing analyzer
XPower, Fit (only CPLD) and Chip viewer (only CPLD).
 Programming the component and formatting the Bit
stream file: Bit Gen and IMPACT.
B. DDR2 Memory Management Used on FPGA Spartan-6
from Xilinx Nexys-3
The Nexys-3 board contains three external memories, all
from Micron: a 128 Mbit cellular RAM (pseudo-static
Fig. 2. Application of Laplacian algorithm to characterize different images DRAM), a parallel non-volatile PCM 128Mbit (phase change
memory); and a 128Mbit PC serial device (Fig. 4). The
In the following figure (Fig. 2), we present the application cellular RAM and the parallel PCM device share a common
of the Laplacian mask on four road images, with the aim of bus, and the serial PCM is on a dedicated quad-mode (x4) SPI
detecting the line in the middle of the road or detecting the bus. Nonvolatile PCM memories are editable bytes and bits
signs of the Highway Code. without the need for block erasure, so they are faster and
The objective of this mask is the ease of implementation more versatile than conventional flash in most applications
and the speed of processing [5], [6]. On the other hand, its [8].

59
International Journal of Machine Learning and Computing, Vol. 9, No. 1, February 2019

The 16Mbyte cellular RAM (Micron M45W8MW16 defined previously in part 3 for the detection of
circuit number) has a 16-bit bus that supports 8-bit or 16-bit contours. The pixels after the conversion are
data access. It can operate as a typical asynchronous SRAM always smaller than the total number of pixels
with 70ns read and write cycle times, or as a synchronous [10].
memory with an 80 MHz bus. When used as an asynchronous The upper limit guarantees that the operations
depending on the FIFO list can be completed
SRAM, the cellular RAM automatically refreshes its internal during the real-time processing period of a frame
DRAM arrays, allowing a simplified memory controller
(similar to any SRAM controller) [9]. When operating in Fig. 4 shows a diagram of the different blocks presented in
synchronous mode, continuous transfers up to 80MHz are Table I, programmed in VHDL and synthetized by Xilinx
possible. ISE software [7], [8].

Fig. 3. Generic Xilinx design flow [7].


Fig. 4. The blocks implemented on Xilinx ISE.

V. REAL-TIME IMPLEMENTATION OF ALGORITHM ON FPGA


XILINX SPARTAN-6 VI. RESULTS OF IMPLEMENTATION AND DISCUSSION
We used Spartan-6 FPGA from the Xilinx Nexys-3 To display the processed images we used a VGA screen
platform for the implementation of our algorithm and a VGA connected directly to a Xilinx Spartan-6 FPGA circuit. Fig. 5
monitor to display the results. The algorithm was developed shows the pre-processing images and Fig. 6shows the same
on the Xilinx ISE interface and the different blocks are images after processing.
programmed in VHDL and presented in the following Table
I:
TABLE I: LIST OF DIFFERENT BLOCKS
Block program objective of the block in the project
Memory The "Memory block” that exists in the party IP
(intellectual property) to the Xilinx software is
configured according to the size of the image that
will store, each memory cell contains 8 bits (8 bits
is the value which is coded each RGB pixel)
Memory Playback Since the image is not necessarily the same size as
the screen, the program is necessary for the correct
positioning of the image on the screen
VGA Screen The program's role to define. The VGA monitor is
controlled by five 10-bit coded signals: red (3 bits),
green (3 bits), blue (2 bits), horizontal sync and Fig. 5. The images results before treatment.
vertical sync 1 bit 1 bit. The three color signals,
collectively known as the RGB signal are used to We used a road images with a resolution of 200x200. The
control the color of a pixel at a location on the module is fully pipelined where a resulting pixel is calculated
screen. In order to produce other colors, each color
at each clock cycle. With this rate and the clock frequency, it
analog signal is to be supplied with a voltage
between 0.7 and 1.0 volts for varying the is possible to treat more than 400 image frames per second at
intensities of the colors 200x200 resolutions.
Synchronization The program lets you synchronize the scanning of In addition, the entire chain has been developed following
pixels on the screen of a horizontally and
vertically. Signals are used to control the the appropriate methodology, Algorithm Architecture. With
synchronization of the scanning speed. The the regular calculations, the necessary reduced memories and
horizontal synchronizing signal determines the the important intrinsic parallelism, it forms an ideal candidate
time to scan one line, while the vertical
synchronizing signal determines the time to scan for hardware implementation on embedded systems [10],
the entire screen. By manipulating these signals, [11].
the images are formed on the monitor screen The results obtained show in Fig. 6 the clear presence of all
Algorithm In this part of the program we use the principle the edges that exist in the images, these results can be used as

60
International Journal of Machine Learning and Computing, Vol. 9, No. 1, February 2019

a tool for detecting road signs to differentiate zones of the REFERENCES


image in order to characterize the lines of the road and to [1] D. Maar and E. Hildreth, “Théorie de la détection de bord,” Actes
extract information reduced, often relevant to characterize the royaleSoc. Londres, vol. 207, pp. 187-217, 1980.
[2] T. Lindeberg, “Edge detection et détection Ridge avec la sélection
road images. echelle automatique,” International Journal of Computer Vision, vol.
30, no. 2, pp. 117-154, 1998.
[3] D. Marimont and Y. Rubner, “Un probabiliste Frameword pour Edge
Détection et Échelle de sélection,” Actes de la Conférence
internationale de l'IEEE sur lavision par ordinateur, pp. 207-214,
Janvier 1998.
[4] J. F. Canny, “A computation approach to edge detection,” IEEE
Transactions on Pattern Analysis and Machine Intelligence, vol. 8, no.
6, pp. 769-798, November 1986.
[5] Pankiewicz, W. Powiertowski, and G. Rozszak, “Implementation of
the Lane Detection Algorithm,” presented at 15th International
Conference IEEE (2008), Poland.
[6] J. C. Mc.Call and M. Trived, “Video-based lane estimation and
tracking for driver assistance: Survey, system, and evaluation,” IEEE
Transactions on Intelligent Transportation Systems, vol. 7, no. 1,
March 2006.
[7] Design-tools. [Online]. Available:
Fig. 6. The images results after treatment.
http://www.xilinx.com/products/design-tools/ise-design-suite.html
[8] fpga-programmable-log. [Online]. Available:
In terms of performance and power consumption, FPGAs http://store.digilentinc.com/fpga-programmable-log
are commonly the lowest in embedded systems, and can [9] S. Nazari et al., “Multiplier-less digital implementation of neuron–
compete by being available quickly, reprogrammable and astrocyte signalling on FPGA,” Neurocomputing, 2015.
[10] I. Bouganssa, M. Sbihi, and M. Zaim, “Implementation of Edge
manufactured with the latest technology [12]. They provide Detection Digital Image Algorithm on a FPGA,” MATEC Web of
an attractive alternative when the resources (cost, time) Conferences, vol. 75, no. 03003, Sept 2016.
required by ASIC development are not available. The ability [11] I. Bouganssa, M. Sbihi, and M. Zaim, “Implementation in an FPGA
circuit of Edge detection algorithm based on the discrete wavelet
to parallelize operations and perform customizable functions transforms,” Journal of Physics: Conf. Series, vol. 870, no. 012016,
also makes them competitive with the sequential 2017.
microprocessor. [12] M. Strzelecki, P. Brylski, and H. Kim, ‘FPGA-based system for fast
image segmentation inspired by the network of synchronized
oscillators,” in Proc. International Conference on Artificial
Intelligence and Soft Computing, pp. 580-590, 2017.
VII. CONCLUSION
Issam Bouganssa was born on February 3, 1987. He
In this paper, we presented an implementation of edge got the university diploma of technology specialized
detection images by Laplacian algorithms on an FPGA for in industrial maintenance at the Higher School of
Technology Sale 2009, professional license
the applications for road safety, detecting panels and roadway. mechatronics at the faculty of Sciences Rabat 2011,
The method is based on the detection of zeros in the change specialized microelectronic master's degree at the
of intensity, the masks of convolutions obtained by the Faculty of Sciences Kenitra 2013, PhD student in
science and techniques for engineers in the Laboratory
computation of the second derivative (for the variation of the
of System Analysis, Information Processing and Industrial Management at
intensity) and a thresholding to select the strongest contours Mohammed-V University in Rabat. Search domain, data processing on
in the road imagery. embedded systems and microelectronic.
In this context, the Field Programmable Gate Array (FPGA)
Mohamed Sbihi was born on November 22, 1962. He
with its large integration and reconfiguration capabilities is a full professor of higher education. He has received
make it a key component for rapidly developing prototypes a graduate degree in electronics and signal processing
[10], [11]. In order to encourage the widespread diffusion of from the Faculty of Science at the Mohammed V
University in Rabat 1995, and the PhD in automatic
such circuits, it is necessary to improve the development and information processing from the Faculty of
environments to make them more accessible to non-experts Science in IbnTofail University in Kenitra 2006. He
in electronics. was employed since 1996 and member of Laboratory
of System Analysis, Information Processing and
To increase the storage capacity on the Spartan-6 circuit, Industrial Management at the Higher School of Technology-SALE in
three external memories available on the Xilinx Nexys-3 Mohammed V University in Rabat, Morocco. He works on Image processing,
platform can be configured: a 128 Mbit cellular RAM Data analysis, University teaching and embedded systems and robotics.
(pseudo-static DRAM), a parallel non-volatile PCM 128Mbit Mounia Zaim was born on July 19, 1973. She
(memory of phase change); and a 128Mbit PC serial device. received the B.S. in eng science from University
To access these external memories, whatever the type, a Mohammed V, Rabat, in 1996, and the M.S. in
telecommunications & microwaves from University
memory controller is used which serves as an intermediary
Chouaib Doukkali, El-Jadida, in 1997 and the Ph.D.
between the user program and the physical memory. The degree in computer vision from University Sidi
controller is also used to perform the operations of commands; Mohammed Ben Abdellah, Fes, in 2002. She is
physical address calculations from logical addresses, data currently a Habilited professor at the Higher School
of Technology-SALE in Mohammed V University,
logging and addresses in FIFOs for Read / Write, automatic Rabat in Morocco, since 2003 and a member of the Research Lab LASTIMI
refresh [12]. The user program deals only with the logical (Laboratory of System Analysis, Information Processing and Industrial
address generation part as well as the Read / Write Management). Her fields of interest are in computer vision, artificial
intelligence, data analysis and e-learning.
commands.

61

You might also like