Distance Transform and Template Matching Based Methods for Localization of Barcodes and QR Codes

Melinda Katona, Péter Bodnár, László G. Nyúl

Visual codes play an important role in automatic identification, which became an inseparable part of industrial processes. Thanks to the revolution of smartphones and telecommunication, it also becomes more and more popular in everyday life, containing embedded web addresses or other small informative texts. While barcode reading is straightforward in images having optimal parameters (focus, illumination, code orientation, and position), localization of code regions is still challenging in many scenarios. Every setup has its own characteristics, therefore many approaches are justifiable. Industrial applications are likely to have more fixed parameters like illumination, camera type and code size, and processing speed and accuracy are the most important requirements. In everyday use, like with smartphone cameras, a wide variety of code types, sizes, noise levels and blurring can be observed, but the processing speed is often not crucial, and the image acquisition process can be repeated in order for successful detection. In this paper, we address this problem with two novel methods for localization of 1D barcodes based on template matching and distance transformation, and a third method for QR codes. Our proposed approaches can simultaneously localize several different types of codes. We compare the effectiveness of the proposed methods with several approaches from the literature using public databases and a large set of synthetic images as a benchmark. The evaluation shows that the proposed methods are efficient, having 84.3% Jaccard accuracy, superior to other approaches. One of the presented approaches is an improvement on our previous work. Our template matching based method is computationally more complex, however, it can be adapted to specific code types producing high accuracy. The other method uses distance transformation, which is fast and gives rough regions of interests that can contain valid visual code candidates.