Reference Guide
Programming / Barcode Reading & Writing / What to do when barcodes are not being recognized
In This Topic
    What to do when barcodes are not being recognized
    In This Topic

    Make sure you have a decent resolution

    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 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 this aspect using the Scale method.

    Getting rid of noise

    Now, we have to agree on what noise is! Generally speaking, noise in scanned images or document images results from:

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

    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 FxDespeckleMore. If the document is binary or in black and white, we highly suggest converting it to 1BPP and then use the much faster FxBitonalDespeckle and FxBitonalDespeckleMore.

      FxBitonalRemoveIsolatedDots4 is helpful in special cases, where the noise patterns are all of a certain size.

    2. Light characters and dimed characters

      In fact, someone would disagree about calling this noise, since it is mainly due to bad scanning when light documents or badly printed documents are 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.

    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 a part of a totally skewed one, we prefer that you use AutoDeskew 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 intersections

      Lines can intersect barcodes and render them unrecognizable. For that, we have added the very advanced function, RemoveLines. 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. The important things, you have to take care of them, are to make sure, that the line's 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.