李健, 申利未, 胡雅婷, 李瑞钊, 任虹宾, 丁小奇. 改进Niblack算法的光照不均匀QR码识别研究[J]. 农业工程学报, 2019, 35(13): 191-196. DOI: 10.11975/j.issn.1002-6819.2019.13.022
    引用本文: 李健, 申利未, 胡雅婷, 李瑞钊, 任虹宾, 丁小奇. 改进Niblack算法的光照不均匀QR码识别研究[J]. 农业工程学报, 2019, 35(13): 191-196. DOI: 10.11975/j.issn.1002-6819.2019.13.022
    Li Jian, Shen Liwei, Hu Yating, Li Ruizhao, Ren Hongbin, Ding Xiaoqi. Research on illumination uneven QR code recognition based on improved Niblack algorithm[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2019, 35(13): 191-196. DOI: 10.11975/j.issn.1002-6819.2019.13.022
    Citation: Li Jian, Shen Liwei, Hu Yating, Li Ruizhao, Ren Hongbin, Ding Xiaoqi. Research on illumination uneven QR code recognition based on improved Niblack algorithm[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2019, 35(13): 191-196. DOI: 10.11975/j.issn.1002-6819.2019.13.022

    改进Niblack算法的光照不均匀QR码识别研究

    Research on illumination uneven QR code recognition based on improved Niblack algorithm

    • 摘要: QR码作为农产品可追溯体系的信息载体,一直是农业领域的科研热点。在实际应用中,溯源环境的复杂多变易使设备采集到光照不均匀的QR码图像而增加解码流程中二值化的难度,影响后续解码。该文针对原始Niblack算法自适应性不足的缺陷,提出一种自适应邻域窗口和修正系数的Niblack算法,该算法依据QR码图像的分辨率和灰度值,动态调整修正系数和邻域窗口,进行自适应二值化处理。分别用改进Niblack算法,原始Niblack算法和Otsu算法处理设备无法识别的不同光照环境下、不同程度的光照不均匀QR码图像,试验数据表明经改进算法处理后的识别成功率为74.2%,高出原始Niblack算法18.4%,高出Otsu算法71.7%,具有较高的鲁棒性。这一结果对农产品在各种光照不均匀环境中的溯源提供了参考。

       

      Abstract: Abstract: As the information carrier of agricultural product traceability system, QR code has always been a research hotspot in the agricultural field. In practical applications, the complexity of the traceability environment makes it easy for the QR code scanner to acquire locally highlighted or shaded QR code images. In the process of binarization, the target pixels of these uneven illumination QR code images are easily misjudged as background pixels or background pixels are misjudged as target pixels which cause the image information lost, resulting in lower recognition rate, this limits the inquirer to some extent. According to the selection of the threshold, the image binarization algorithms can be divided into global threshold methods and local threshold methods. By setting the segmentation threshold on the grayscale image, all the pixels in the grayscale image are divided into two categories: The target pixel and the background pixel. The gray value of the target pixel is set to 0, and the visual representation is black; the gray value of the background pixel is set to 255, and the visual representation is white. When the gray value of the pixel is greater or equal to the set segmentation threshold, it will be divided into the background pixel class; when it is smaller the set segmentation threshold, it will be divided into the target pixel class. The global threshold method represented by the Otsu algorithm is suitable for an image with a clear bimodal and uniform illumination in a gray histogram, but since the threshold is a fixed value, the fidelity is low when processing an image with uneven illumination. As a local threshold method, the Niblack algorithm can dynamically calculate the neighborhood center threshold in combination with the gray mean and variance in the neighborhood window. That is, for each pixel, the Niblack algorithm can calculate the corresponding threshold. Therefore, there is a good effect in splitting an image with uneven illumination, but the segmentation effect depends on the preset of the local window and the correction coefficient value. Since the correction coefficient and neighborhood window are fixed values selected according to experience, it is easy to cause the correction coefficient or neighborhood window used in some scenes to be unsuitable for another scene, so the original Niblack algorithm is less versatile. This paper proposes a Niblack algorithm that adaptive neighborhood window and correction coefficient. The algorithm dynamically adjusts the size of the neighborhood window according to the resolution of the QR code image, according to the gray mean and variance of the pixel points in the neighborhood window. The gray value information of the whole image is dynamically adjusted and corrected to realize adaptive binarization processing. Experiments show that compared with the original Niblack algorithm, the algorithm can more effectively segment the uneven light QR code image that the device cannot recognize. After the algorithm is processed, the recognition success rate of the unrecognizable QR code image reaches 74.2%, which is 18.4% higher than the original Niblack algorithm and is 71.7% higher than Otsu algorithm. The study has certain reference significance for the traceability of agricultural products in the uneven illumination environment.

       

    /

    返回文章
    返回