摘要
QR 码作为农产品可追溯体系的信息载体,一直是农业领域的科研热点。在实际应用中,溯源环境的复杂多变易使设备采集到光照不均匀的 QR 码图像而增加解码流程中二值化的难度,影响后续解码。该文针对原始 Niblack 算法自适应性不足的缺陷,提出一种自适应邻域窗口和修正系数的 Niblack 算法,该算法依据 QR 码图像的分辨率和灰度值,动态调整修正系数和邻域窗口,进行自适应二值化处理。分别用改进 Niblack 算法,原始 Niblack 算法和 Otsu 算法处理设备无法识别的不同光照环境下、不同程度的光照不均匀 QR 码图像,试验数据表明经改进算法处理后的识别成功率为 74.2%,高出原始 Niblack 算法 18.4%,高出 Otsu 算法 71.7%,具有较高的鲁棒性。这一结果对农产品在各种光照不均匀环境中的溯源提供了参考。
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.
作者
李健
申利未
胡雅婷
李瑞钊
任虹宾
丁小奇
Li Jian;Shen Liwei;Hu Yating;Li Ruizhao;Ren Hongbin;Ding Xiaoqi(College of Information Technology, Jilin Agricultural University, Changchun 130118, China;Jilin Province Bioinformatics Research Center, Changchun 130118, China)
出处
《农业工程学报》
EI
CAS
CSCD
北大核心
2019年第13期191-196,共6页
Transactions of the Chinese Society of Agricultural Engineering
基金
国家自然科学基金项目(41601454)
关键词
图像处理
光照
识别
农产品可追溯体系
QR
码
二值化
Niblack
算法
image processing
illumination
recognition
agricultural products traceability system
QR code
binarization
Niblack algorithm