Laplacian Edge Detection Algorithm for Road Signal
Laplacian Edge Detection Algorithm for Road Signal
1, February 2019
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)
𝐺𝑟𝑎𝑑 ƒ = 𝜵 ƒ = (
𝜕𝑥
𝜕ƒ ) (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].
60
International Journal of Machine Learning and Computing, Vol. 9, No. 1, February 2019
61