Barcode reading with Halcon image processing software


Barcode identification with image processing in machine vision has numerous applications. Barcodes are automatically read at high speed by barcode reader software in machine vision. This article explores the identification of various types of barcodes using the powerful HALCON software (developed by the German company MVtec). We will also implement a practical example with a regular camera. The example includes identifying various QR Codes, Bar Codes, and Data Codes using Halcon software.

To register for the “Machine Vision Training Course with HALCON Software,” click here.

Barcode Identification with Halcon Image Processing Software

Halcon is the most powerful and best image processing software for implementing barcode readers. It includes numerous ready-made examples for barcode reader implementation. (Read about searching for specific examples in the “1000 Image Processing Projects with Ready-Made Source Codes” article.) To access these examples and use them for your projects, download the Halcon software here and follow the installation instructions here.


Halcon software can easily read various barcode types, even in challenging conditions such as exposure to excessive light (where very thin printed bars are displayed), lack of focus, etc. Additionally, in the implementation of barcode reader software with image processing, all barcodes can be identified without considering their rotation (rotation here means the barcode having an angle relative to the horizontal axis) or if a part of the barcode is not visible in the image.

Reading defective barcode with Halcon image processing software

Detecting defective barcode with Halcon software

Reading Defective Barcode with Halcon

Halcon software can detect images in “intense light” or “ink spread” conditions with good accuracy. Intense light conditions, as seen in the figure, make barcodes thinner. Also, ink spread makes barcodes thicker, usually due to a printer error.

The power of Halcon software in barcode identification

Simultaneous Detection of Various Barcodes at High Speed

Halcon software can detect multiple barcodes in a single program invocation. Additionally, Halcon can identify various types of barcodes and achieve high-speed barcode reading. The speed of reading depends on various factors, including the type of barcode, barcode quality, image pixel count, barcode pixel count, and image light. By selecting the right parameters, Halcon can perform barcode identification with image processing in about 2 milliseconds.

Reading multiple barcodes with Halcon software simultaneously

Finding various types of barcodes in the program

Data Code Identification with Halcon

In addition to identifying various barcode types, Halcon software can also identify less common and less used special codes and various data codes (ECC 200, QR, Micro QR, Aztec, DotCode, and PDF417) of any size. Special codes such as Aztec codes, commonly used in ticket sales applications, and Micro QR codes for small products are also supported. These codes cannot be used with regular QR codes due to their size.

Reading Aztec Code with powerful image processing software Halcon

Reading Aztec Code with Halcon software

Identifying Micro QR with Halcon software

Identifying Micro QR with Halcon software

Implementation of Barcode Reader with Halcon

Halcon software makes it easy to read barcodes. We implemented a practical example using Halcon software. The implementation steps are explained below.

Samples Obtained from QR Code, Bar Code, and Data Code

Various samples of codes have been obtained from pharmaceutical and health products. The selected three samples are Bar Code, QR Code, and Data Code, which are among the most commonly used types in various industries. These samples are visible in the image below.

Various barcode samples

Reading Barcodes with a Regular Camera

For the implementation of the barcode reader with Halcon software, a regular USB webcam has been used. The camera’s image size is 480*640. The camera is placed on a stand to view the surface vertically where the barcode is placed. The camera is connected to the laptop via USB. We can connect to the camera through Halcon software and process barcode images.

Using USB camera for barcode reader implementation

Software Output for Barcode Reader

We move each of the Data Code, Bar Code, and QR Code samples under the camera. The barcodes will be found during movement. As shown in the tutorial video below, all Data Code, Bar Code, and QR Code are easily found during movement.

Detecting barcode with Halcon HALCON

Identifying data codes with image processing HALCON

QR code reader with image processing HALCON

Reading barcodes with HALCON software

Implementing barcode reader projects with image processing

Detecting and identifying barcodes with image processing


In this article, we demonstrated the power of Halcon software in reading barcodes. With a regular camera, we were able to easily identify various QR Codes, Bar Codes, and Data Codes in motion using the powerful HALCON software. Considering the obtained results, reading barcodes with Halcon software is easily achievable. Here, we used a regular USB camera. Given that professional cameras with lighting are used in machine vision for image processing, reading barcodes will undoubtedly be even easier.

For your projects, you can consult with our experts [here](https://www.visionsystems.ir/consulting/).

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

ارتباط سریع با ما