FPGA Implementation of Sobel Edge Detection Algori
FPGA Implementation of Sobel Edge Detection Algori
Abstract
Sobel Edge detection algorithm is used to extract the edges (region of maximum variation) from an image. It is based on
the concept that the edges of an image contains maximum information whose computation depends on multipliers and
square root. As multipliers consume more logic, a modified sobel edge detection algorithm which does not employ
multipliers and square root function is proposed. A mathematical model of the proposed sobel edge algorithm was first
developed and MATLAB was used to verify the model. On comparing with the original model, the proposed model has a
SSIM of 96.43%. To analyse the hardware complexity, Verilog model of the modified sobel edge detection algorithm was
developed using Quartus II. The chosen evaluation board is Cylone III FPGA EP3C120F780. The performance metrics
such has Logic Elements utilization, Power dissipation and Maximum Operating Frequency were obtained. Open-Source
toolchain (Yosys, OpenVPR, and Google Skywater 130nm PDK) was used to obtain the RTL Netlist and Synthesis
reports. Verilog Modules for the Camera (CMOS OV7670) interface and FIFO Buffer were synthesized. The modified
algorithm was integrated with them. An HSMC (HSMB) breakout board was connected to the FPGA Development board
to increase the number of I/O ports. Thus in real time, the proposed modified Sobel Edge detection system can be used as a
pre-processor to reduce the amount of computations and power consumption.
Copyright © 2024 Navinkumar et al., licensed to EAI. This is an open access article distributed under the terms of the CC BY-NC-
SA 4.0, which permits copying, redistributing, remixing, transformation, and building upon the material in any medium so long as
the original work is properly cited.
doi: 10.4108/eetiot.5148
Instead of this, a simple sign reversal is used to remove To implement pipelined design in Verilog, a combination
the negative signs and then they are added together. This of registers and combinational logic can be used. Each
is then repeated for the entire image. This has been stage performs a specific operation on the data and then
explained in Figure 2. passes the result to the next stage. The stages are
connected by registers, which hold the data as it moves
through the pipeline.
3.4. Real-Time Implementation of the The Cyclone III FPGA core has two parts working in
Proposed Sobel algorithm using Cyclone different clock domains. The camera module continuously
III FPGA senses and sends the data to the camera interface module.
It is then interfaced with the Sobel Unit using a FIFO
The requirements for the real time implementation are: buffer. It allows the data to be read in the same order in
• Live feed from an input source which it is inserted. The results are then stored in the
• Input source – can be a camera (OV7670) or RAM module. PLL is used to provide the necessary
from PC through UART Module clocks from the on-board oscillator. The specification
• Need a buffer for read and write operations. sheets should be referred to know the frequency of
• On-board SRAM insufficient. operation of various peripherals.
• SDRAM – For holding the data temporarily
• FIFO Buffer for interfacing modules with The orange coloured regions depict the domain, which
different speeds works in 24 MHz clock domain. The blue is for 166.67
MHz clock domain. The camera works in I2C mode.
The OV7670 is a low-power CMOS image sensor
designed for use in portable devices such as mobile PHY is the physical layer of the SDRAM Controller. An
phones, laptops, and digital still cameras. It is a VGA FSM based design is used. The IP is obtained from the
(640x480) resolution image sensor that can operate at up megacore function wizard of Quartus II. While creating
to 60 frames per second and is capable of capturing high- the IP, specifications such as the frequency, burst mode,
quality images and video in a wide range of lighting frames, error correction mode must be set properly in
conditions. The OV7670 includes on-chip image accordance with datasheet of the SDRAM DDR2
processing functions, such as color interpolation, gamma controller.
correction, and white balance, which can improve the
quality of the captured images. The OV7670 has good
low light sensitivity, allowing it to capture good-quality
images in low light conditions.
The performance metrics chosen are number of logic Figure 12 shows the DDR2 SDRAM RTL netlist.
elements, total thermal power dissipation, maximum
frequency of operation and the number of multipliers
used. Figure 8 shows the number of logic elements
utilized in the existing and in the proposed work.
Figure 9. Thermal Power dissipation comparison Figure 13 shows the real time implementation RTL netlist
of the proposed sobel algorithm by interfacing the camera
Figure 10 shows the maximum frequency of operation in module with Cyclone III FPGA.
the existing and in the proposed work.
From Figures 8, 9 and 10, it is inferred that the proposed Figure 13. RTL Netlist of the proposed sobel edge
work has completely eliminated the use of multiplier. algorithm
However this has led to the slight increase 21.62% in the
Figure 14 shows the performance metrics of the proposed Conference on Consumer Electronics - Asia (ICCE-Asia),
sobel algorithm in real time. 2020, pp. 1-2, doi: 10.1109/ICCE-
Asia49877.2020.9277425.
[3] A. Abbasi, M. Abbasi, A proposed FPGA based
architecture for sobel edge detection operator, J. Act.
Passive Electron. Devices, 2, 2007.
[4] I. Yasri, N. H. Hamid, and V. V. Yap, “Performance
analysis of FPGA based Sobel edge detection operator,”
2008 International Conference on Electronic Design, Dec.
Figure 14. Real-time implementation Performance 2008, doi: 10.1109/ICED.2008.4786751.
metrics [5] S. Halder, D. Bhattacharjee, M. Nasipuri, D.K. Basu, A
Fast FPGA Based Architecture for Sobel Edge Detection,
From the results, it is inferred that the proposed sobel Springer, 2012.
algorithm in real time uses totally 603 logic elements, [6] J. Monson, M. Wirthlin, B. L. Hutchings, “Optimization
dissipates 118.77 mW and operates at a speed of 219 techniques for a high level synthesis implementation of the
Sobel filter”, In Proceedings of the International
MHz as shown in Table 2. Conference on Reconfigurable Computing and FPGAs
(ReConFig), 2013, pp. 1-6.
Table 2. Performance Metrics of the proposed sobel https://doi.org/10.1109/ReConFig.2013.6732315.
edge in real time [7] G. Chaple, R.D. Daruwala, “Design of Sobel operator
based image edge detection algorithm on FPGA”, In
Performance metrics Proposed Proceedings of the International Conference on
Sobel Communication and Signal Processing, 2014, pp. 788-792.
algorithm in https://doi.org/10.1109/ICCSP.2014.6949951
[8] M. Chouchene, F. E. Sayadi, Y. Said, M. Atri, and R.
Real Time Tourki, “Efficient implementation of Sobel edge detection
Logic Element Utilization 603 algorithm on CPU, GPU and FPGA”, International
Total Thermal Power Dissipation 118.77 mW Journal of Advanced Media and Communication, 5,(2/3),
Maximum Frequency of Operation 219 MHz 2014, p.105.
No. of Multipliers Used 0 [9] M. Amiri, F. M. Siddiqui, C. Kelly, “FPGA-Based Soft-
Total Registers 310 Core Processors for Image Processing Applications” J Sign
Process Syst, 87, 2017, pp. 139–156.
https://doi.org/10.1007/s11265-016-1185-7
Figure 15 shows the real time implementation of the [10] K. Zhang, Y. Zhang, P. Wang, Y. Tian, and J. Yang, “An
proposed sobel algorithm by interfacing the camera improved sobel edge algorithm and FPGA
module with Cyclone III FPGA. implementation,” Procedia Computer Science, 131, 2018,
pp. 243–248, doi: 10.1016/j.procs.2018.04.209.
[11] N. Nausheen, A. Seal, P. Khanna, S. Halder, “A FPGA
based implementation of Sobel edge detection,” Science
Direct, Microprocessors and Microsystems, 56, 2018, pp.
84-91, https://doi.org/10.1016/j.micpro.2017.10.011.
[12] Z. Xiangxi, Z. Yonghui, Z. Shuaiyan, Z. Jian, “FPGA
implementation of edge detection for Sobel operator in
eight directions”, In Proceedings of the IEEE Asia Pacific
Conference on Circuits and Systems, Chengdu. 2018, pp.
520-523.
[13] K. Hill, S. Craciun, A. George, H. Lam, “Comparative
analysis of OpenCL vs. HDL with image-processing
kernels on stratix-v FPGA”, In Proceedings of the IEEE
26th International Conference on Application-specific
Systems, Architectures and Processors (ASAP),
Figure 15. Real time implementation of the 2015, https://doi.org/10.1109/asap.2015.7245733.
proposed sobel algorithm by interfacing the camera [14] H. Waidyasooriya, M. Hariyama, and K. Uchiyama,
module with Cyclone III FPGA “Design of FPGA-based computing systems with
OpenCL”, Springer International Publishing,
2018, https://doi.org/10.1007/978-3-319-68161-0
References [15] D. R. Menaka, D. R. Janarthanan, and D. K. Deeba,
“FPGA implementation of low power and high speed
[1] B. Saha Tchinda, D. Tchiotsop, M. Noubom, V. Louis- image edge detection algorithm,” Microprocessors and
Dorr, and D. Wolf, “Retinal blood vessels segmentation Microsystems, 75, 2020, p. 103053, doi:
using classical edge detection filters and the neural 10.1016/j.micpro.2020.103053.
network,” Informatics in Medicine Unlocked, 23, 2021, [16] G. K. Ijemaru et al., “Image processing system using
p.100521, doi: 10.1016/j.imu.2021.100521. matlab-based analytics,” Bulletin of Electrical Engineering
[2] Y. H. Kwon and J. W. Jeon, "Comparison of FPGA and Informatics, 10, (5), 2021, pp. 2566–2577, doi:
Implemented Sobel Edge Detector and Canny Edge 10.11591/eei.v10i5.3160.
Detector", In Proceedings of the IEEE International