A parallel Canny edge detection algorithm based on OpenCL acceleration

PLoS One. 2024 Jan 5;19(1):e0292345. doi: 10.1371/journal.pone.0292345. eCollection 2024.

Abstract

In the process of Canny edge detection, a large number of high complexity calculations such as Gaussian filtering, gradient calculation, non-maximum suppression, and double threshold judgment need to be performed on the image, which takes up a lot of operation time, which is a great challenge to the real-time requirements of the algorithm. The traditional Canny edge detection technology mainly uses customized equipment such as DSP and FPGA, but it has some problems, such as long development cycle, difficult debugging, resource consumption, and so on. At the same time, the adopted CUDA platform has the problem of poor cross-platform. In order to solve this problem, a fine-grained parallel Canny edge detection method is proposed, which is optimized from three aspects: task partition, vector memory access, and NDRange optimization, and CPU-GPU collaborative parallelism is realized. At the same time, the parallel Canny edge detection methods based on multi-core CPU and CUDA architecture are designed. The experimental results show that OpenCL accelerated Canny edge detection algorithm (OCL_Canny) achieves 20.68 times acceleration ratio compared with CPU serial algorithm at 7452 × 8024 image resolution. At the image resolution of 3500 × 3500, the OCL_Canny algorithm achieves 3.96 times the acceleration ratio compared with the CPU multi-threaded Canny parallel algorithm. At 1024 × 1024 image resolution, the OCL_Canny algorithm achieves 1.21 times the acceleration ratio compared with the CUDA-based Canny parallel algorithm. The effectiveness and performance portability of the proposed Canny edge detection parallel algorithm are verified, and it provides a reference for the research of fast calculation of image big data.

MeSH terms

  • Acceleration
  • Algorithms*
  • Big Data
  • Judgment
  • Software*

Grants and funding

This work was supported by the National Natural Science Foundation of China (Nos. 61572444, 61250007), the Key Scientific Research Projects of Henan Province Colleges and Universities of China (No. 22A520049), and the Natural Science Foundation of Shandong Province (No. ZR2022MD039). The funders had no role in research design, data collection and analysis, and the decision to release or prepare the manuscript.