Free Support Forum - aspose.com

Barcode Reading - results are different in different orientations and rectangles

TLDR: We have observed that the bar code reader results are different when source images are rotated 90 degrees, or when the rectangle defining the read region is changed.

Details:
We are reading i2of5 and DataMatrix bar codes on image files scanned from A4 sized paper at 200dpi. We observed that the reading was very slow on the full page, so we added a rectangular region where we search for each bar code. One of the bar codes is used to determine the orientation of the paper in the scan, so we look for it on all 4 corners.

First, we noticed that the read success rate changed when we added the rectangles, and second, we noticed that the read success rate was sensitive to changes in the rectangle size. We are unable to determine how to correctly size the rectangle for maximum success, only that changing the rectangle changes the results.

We also observed some variability on the read success if the bar codes were rotated 90 degrees. In particular, bar codes that are vertical with right orientation have a success rate about 75% of all the other orientations.

Is there any guidance you can give on sizing the read rectangle for maximum success, and is there some reason we should see lower read success with right oriented barcodes?

@bretton.wade.leidos.com,
Could you please share few sample barcode images and sample code which you used for different scenarios? We will reproduce the issue here and provide assistance accordingly.

Recognition process are different for DataMatrix and 1D barcodes. I don’t think that DataMatrix are sensitive to rectangle splitting in case whole DataMatrix barcode appears in the region. For Datamatrix detection we use extremely modified LSD algorithm it is orientation insensitive.

1D barcodes are detected in two stages.

First stage we detects possible areas with 1D barcodes and possible orientation in these areas. There are two algorithms. First algorithm detects features in image cells and cluster cells with wave/Lee algorithm depends on multivariate analyzes.

For this you can use
QualitySettings.UseOldBarcodeDetector.

Second algorithm use the same features detection and use SVM detector. This is fast replacement of Neural Networks. This algorithm is used in default mode but it is customizable.

For customization you can use presets like this
QualitySettings.DetectorSettings = BarcodeSvmDetectorSettings.MaxQuality.

I the detection stage algorithms could be sensitive to reducing search area with region selection.

The second stage is insensitive to orientation (for most of barcode types) and scanning and recognizing barcodes in these areas aren’t affected by region selection.

Hi Ahsan Iqbal,

I’m attaching 11 images that demonstrate the problem we are having. If we rotate these images to be “upright”, the barcodes scan reliably. In this orientation, they do not. Updating to the latest version of Aspose Barcode.Net did not change the behavior. The settings we are using are:

qualitySettings = QualitySettings.MaxBarCodes;

  qualitySettings.DetectorSettings.SkipDiagonalSearch = true;

  qualitySettings.DetectorSettings.ScanWindowSizes = new List<int>(new int[] { 15, 10 });

  qualitySettings.DetectorSettings.SimilarityCoef = 0.5f;

  qualitySettings.DetectorSettings.RegionLikelihoodThresholdPercent = 0.8f;



  qualitySettings.AllowQRMicroQrRestoration = false;

  qualitySettings.AllowDatamatrixIndustrialBarcodes = false;

  qualitySettings.AllowDetectScanGap = true;

  qualitySettings.AllowSaltAndPaperFiltering = true;

  qualitySettings.AllowMicroWhiteSpotsRemoving = true;

  qualitySettings.AllowOneDFastBarcodesDetector = false;

  qualitySettings.UseOldBarcodeDetector = false;

  qualitySettings.AllowRegularImage = true;

  qualitySettings.AllowOneDWipedBarsRestoration = false;

  qualitySettings.AllowMedianSmoothing = false;

  qualitySettings.AllowComplexBackground = true;

  qualitySettings.AllowIncorrectBarcodes = true;

  qualitySettings.AllowInvertImage = false;

  qualitySettings.AllowWhiteSpotsRemoving = true;

Can you advise on what we can do about this? Right now Aspose is getting 75% accuracy, which is unacceptable for our customer.

Regards,

Bretton

Chip_Fails.zip (5.1 MB)

@bretton.wade.leidos.com,
I have tried the same set of images and also by rotating all by 90 degree but could not read any. Please share the set of images which are read properly along with the runnable complete console application for our testing. We will reproduce the scenario and share the feedback.

Found the problem. The problem is related with additional different recognition algorithm which we run depending on orientation. The deep problem investigation is planned on September 2020.