作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2023, Vol. 49 ›› Issue (11): 257-266. doi: 10.19678/j.issn.1000-3428.0067337

• 图形图像处理 • 上一篇    下一篇

基于OpenGL ES的图像滤波算法实现及优化研究

常文斌1,2, 牟明任2, 贾海鹏2,*, 张云泉2, 张思佳1   

  1. 1. 大连海洋大学 信息工程学院, 辽宁 大连 116023
    2. 中国科学院计算技术研究所 处理器芯片全国重点实验室, 北京 100190
  • 收稿日期:2023-04-04 出版日期:2023-11-15 发布日期:2023-11-08
  • 通讯作者: 贾海鹏
  • 作者简介:

    常文斌(1999—),男,硕士研究生,主研方向为并行计算、高性能计算

    牟明任,硕士研究生

    张云泉,研究员、博士生导师

    张思佳,博士

  • 基金资助:
    国家自然科学基金(61972376); 国家自然科学基金(62072431); 国家自然科学基金(62032023)

Research on the Implementation and Optimization of Image Filtering Algorithm Based on OpenGL ES

Wenbin CHANG1,2, Mingren MU2, Haipeng JIA2,*, Yunquan ZHANG2, Sijia ZHANG1   

  1. 1. College of Information Engineering, Dalian Ocean University, Dalian 116023, Liaoning, China
    2. State Key Laborary of Processors, Institute of Computing Technology, Chinese Academy of Sciences, Beijing 100190, China
  • Received:2023-04-04 Online:2023-11-15 Published:2023-11-08
  • Contact: Haipeng JIA

摘要:

图像滤波算法广泛应用在机器学习、图像处理、图像识别等领域,在降低椒盐噪声、图像二值化、边缘识别和特征提取等方面发挥着重要作用。现有图像滤波算法虽然在OpenCV开源库中均有实现,但是在Android平台的性能表现与其他平台相比仍存在较大差距。随着嵌入式平台的高速发展,实际应用对嵌入式平台上滤波算法的性能要求越来越高。为此,从形态学滤波、盒式滤波、阈值滤波、压缩滤波、算术滤波等具有广泛应用场景的滤波算法入手,提出并实现针对Android平台设计、基于OpenGL ES的一系列高性能图像滤波算法。使用OpenGL ES计算着色器对算法进行并行加速,使用纹理对象进行访存优化,并在图像边界处理、图像数据类型和数据通信等方面进行深入优化,取得了较优的性能。将优化的图像滤波算法与开源OpenCV库中对应算法进行对比,实验结果表明,基于Android平台使用OpenGL ES接口的图像滤波算法整体性能明显优于OpenCV库中的相关算法,且图像规模越大计算优势越明显,性能最大提升为OpenCV库中对应算法的110.018倍。

关键词: OpenGL ES接口, 图像滤波, 嵌入式平台, 计算着色器, 图像纹理

Abstract:

Image filtering algorithms have wide applications in such fields as machine learning, image processing, and image recognition.They play an important role in reducing "salt and pepper" noise, image binarization, edge recognition, and feature extraction. Although common image filtering algorithms are implemented in the OpenCV open source library, a significant gap in performance exists compared with other platforms on the Android platform. With the rapid development of embedded platforms, the performance requirements for filtering algorithms on embedded platforms have become increasingly high in practical applications. Therefore, starting with filtering algorithms with wide application scenarios, such as morphological filtering, box filtering, threshold filtering, compression filtering, and arithmetic filtering, a series of high-performance image filtering algorithms designed for the Android platform based on OpenGL ES are developed and implemented. OpenGL ES calculation shaders are used to accelerate the algorithm in parallel, using texture objects for memory optimization, and in-depth optimization in image boundary processing, image data types, and data communication is conducted. This approach resulted in better performance. The optimized image filtering algorithm is compared with the corresponding algorithm in the open-source OpenCV library. The experimental results show that the overall performance of the image filtering algorithm based on the Android platform using the OpenGL ES interface is significantly better than the performances of the relevant algorithms in the OpenCV library. The larger the image size, the more obvious the computational advantage. The maximum performance improvement is 110.018 times that of the corresponding algorithm in the OpenCV library.

Key words: OpenGL ES interface, image filtering, embedded platform, calculation shader, image texture