How to Improve the Accuracy of Barcode Decoding?

Situations such as the Dynamsoft Barcode Reader does not successfully decode all the barcodes from the files may occur from time to time. The solution to that problem is to modify the runtime settings before decoding the files.

Gray Equalization

The sample image used in this example is a Green cup shown as below.

The demo used to decode the barcode is BarcodeReaderDemo.exe located in C:\Program Files (x86)\Dynamsoft\Barcode Reader 6.4\Samples\Desktop\C#\BarcodeReaderDemo\BarcodeReaderDemo\bin\Debug_VS2015 or the path you set install our SDK. At first, the image is decoded by all the three recognition modes: best speed, balance and best coverage.

As can be seen from the image above, the image is a bit dark. Therefore, it is recommended to turn the Gray Equalization Sensitivity function on, set it to 7 or even higher to 9, and set the Binarization Block Size to 40. The image below shows that the barcode is recognized successfully.

Another example is shown below.

Executed by the all three modes, the barcode cannot be decoded successfully. However, if the Gray Equalization function is used and set it to 5 or above, without any other changes in the best coverage mode, the barcode is decoded successfully as shown below.

Binarization Block Size

Another possible reason for decoding failure is Binarization Block Size. The block size determines local region neighbouring pixel size which is associated for each pixel to separate into two intensities - black and white. If the size is too large, some barcodes may be ignored by the algorithms. The sample image used for decoding is shown below.

After executing with the default runtime setting, five barcodes are localized by the program while only three are decoded successfully. As you can see from the image below with Default Runtime Settings, three barcodes are decoded successfully within the green frames while other two are localized with red frames. The red frame means the barcodes are localized but not decoded. As you can see, the words are localized by the program by mistake.

The barcodes, comparing to the while image, are small. Therefore, to improve the accuracy, the block size can be modified to a small value, for example, in order to exclude the text from localization, the value of 30 pixels is set.

As the image is a gray scale image and the difference between pixels is quite clear, there is no need to turn on the Gray Equalization Sensitivity. Besides, the Fill Binary Vacancy function should be turned off as it may cause some distortion. The function is created to fill in the vacant area with black, such function will fill in the vacant areas which are not desired.

In the image below, with Updated Runtime Settings shown above, the text is not excluded in the final results, and for the barcode at the bottom of the image, it is localized but the opportunity to decode it is rather low.

Pre-Region Detection Mode

Pre-Region Detection is a function to allow the program to speed up the localization process and recognition for the scenario of small barcode in big image. The following example is to show the difference of the on and off of the function. For safety issue, the image has been processed the black area is where the barcode is located.

With the Pre-Region Detection mode enabled, the result is shown below.

The red boxes mean the barcodes are localized but not decoded. The barcode is not decoded successfully and there is another region is localized while it is not barcode. With the Rre-Region Detection function disabled and no changes to other settings, the barcode is decoded successfully as shown below, in the green box.

Pre-Region Detection is disabled as default, sometimes it may be turned on for some scenarios, when there is some difficulty localizing the right barcode area, it is recommended to disable it for accuracy.

results matching ""

    No results matching ""