[Tutorial]Things to do when barcodes are not recognized

Discussions about barcode reading and writing
Post Reply
SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

[Tutorial]Things to do when barcodes are not recognized

Post by SamiKharma » Tue Jun 19, 2012 10:33 am

Hi,

One of our most frequent support requests is something of the following sort:
"The barcode in this image is not being recognized, why not? What can I do?"

After explaining the same steps, 95% of barcodes in images are recognized. In this tutorial, we will explain things you could do to ensure a better recognition of your barcodes.

NUMBER 1: MAKE SURE YOU HAVE THE PROPER DPI
This is probably the most important one. For barcodes to be rendered, they have to be vectorized, and for that to happen, they need to exist with sufficient pixels drawing them compared to their size.
Thus, your images should be at least of 200 dpi, 300 dpi will be optimal. If they are scanned at a different resolution, you can easily change their dpi using GdPicture.

NUMBER 2: GETTING RID OF NOISE
Now, we have to agree on what noise is! Generally speaking, noise in scanned images, or document images in general, results from:
a. bad scanners
b. bas scanning options
c. low quality documents


Since noise can be caused by different factors, or a combination of them, noise in one image can be totally different in another, thus it will have to be treated differently.

I shall try to list some types of noise, and what to do with them:
1. Salt and Pepper Noise:
The term is basic in image processing, and is used to describe noise that is in the form of black and white dots or either on your document. This kind is usually caused by bad scanners, and bad scanning options.
What you can do is use fxDespeckle and fxDespeckle more. If the document is binary or in black and white, I highly suggest converting it to 1BPP, and then use the much faster fxBitonalDespeckle and fxBitonalDespeckleMore (Available only in V9).
FxBitonalRemoveIsolatedDots4 is helpful in special cases, where the noise patterns are all of a certain size.

2. Light characters, and Dim characters (Low noise and dark noise):
In fact, some would disagree about calling this noise, since it is mainly due to bad scanning, light documents, or badly printed documents being scanned. Still, as Image Processing goes, it is called noise, and binary operations are used for that. FxErode and fxDilate are particularily helpful.

3. WhiteOut Noise:
This is mainly due to bad scanners, and low dpi scanning, that would not change after you have increased the dpi, because the scanning has already omitted valuable information in the barcode. For that, your last resort will be FxBitonalFillHolesH and FxBitonalFillHolesV.

NUMBER 3: IMAGE CONTENT INTERFERENCE
The barcode itself could be intersected with other objects, or the whole image could be tilted.
1. Skewed Image:
Even though our barcode engine is good at detecting skewed barcodes and even returning the angle it was written with, if the barcode is skewed as part of a totally skewed, we perfer that you use fxAutoDeskew on the image before any kind of barcode detection. Scanned images can always be scanned at a skewed angle due to either human or machine faults.

2. Lines intersection:
Lines can intersect barcodes and render them unrecognizable. For that, we have added the very advanced function, RemoveLines (in V9). Take your time and play with it, try to understand the parameters. If used right, it can remove the whole intersecting line without changing the barcode. Things you have to take care of it to make sure that the lines length to be removed is greater than the barcode lines if it is in the same direction, and to keep to have the ReConnectBrokenCharacters parameter at True so the barcode is not emptied out.

I think this covers it for now. If you have used different approaches that have worked for you, please feel free to post them here so others can take advantage of them.

Best Regards,
Sami

Gabriela
Posts: 436
Joined: Wed Nov 22, 2017 9:52 am

Re: [Tutorial]Things to do when barcodes are not recognized

Post by Gabriela » Fri Mar 29, 2019 10:11 pm

Here is the link to the updated article within our Reference guide:
https://www.gdpicture.com/guides/gdpicture/web ... nized.html
You can find more examples of how to work with barcodes in this guide as well.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest