Free Support Forum - aspose.com

Qr Code not recognized but boofCv does

Hi,

Here is an example of a Qr Code not recognized by Aspose.BarCode but recognized by BoofCv.
I tried a lot of QualitySettings tweaks but none seems to work.

Many thanks in advance
IMG_7974.jpg (383.4 KB)

@n.gaudin,

Thanks for the image file.

I tested using Aspose.BarCode for .NET v20.6 (please try it) and it works fine. The API successfully recognized the QR code. I used the following sample code:
e.g
Sample code:

 var bmp = new Bitmap("e:\\test2\\IMG_7974.jpg");

            using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader(bmp, Aspose.BarCode.BarCodeRecognition.DecodeType.QR))
            {
                //enahnce detection for low or deteriorated image
                //reader.QualitySettings.DetectorSettings = Aspose.BarCode.BarCodeRecognition.BarcodeSvmDetectorSettings.HighQuality;
                Console.WriteLine(reader.ReadBarCodes().Length);

                foreach (Aspose.BarCode.BarCodeRecognition.BarCodeResult result1 in reader.ReadBarCodes())
                {
                    // Read symbology type and code text
                    Console.WriteLine("Symbology Type: " + result1.CodeType);
                    Console.WriteLine("CodeText: " + result1.CodeText);
                }
            }

If you still find the issue with Aspose.BarCode v20.6, let us know with details and sample code (runnable) to reproduce the issue, we will check it soon.

Hi,
Thanks for your response.

I am using Aspose.BarcCode 20.6 Java (not .Net)
We are currently testing to buy it if we are convinced.

I can assure you its not wrking with the following code:

        BarCodeReader reader;
        try {
            reader = new BarCodeReader(ImageIO.read(new File(path)), DecodeType.QR);
            reader.setQualitySettings(QualitySettings.getHighQuality());
            reader.getQualitySettings().setDetectorSettings(BarcodeSvmDetectorSettings.getHighQuality());
            reader.getQualitySettings().setAllowDecreasedImage(true);
            reader.getQualitySettings().setAllowMedianSmoothing(true);
            reader.getQualitySettings().setMedianSmoothingWindowSize(4);
            //reader.getQualitySettings().setAllowQRMicroQrRestoration(true);
            //reader.getQualitySettings().setAllowRegularImage(false);
            //reader.getQualitySettings().setAllowInvertImage(true);
            //reader.getQualitySettings().setUseOldBarcodeDetector(true);

            //System.out.println(reader.getQualitySettings().getAllowRegularImage());
            BarCodeResult[] barCodeResults = reader.readBarCodes();
            if (barCodeResults.length > 0) {
                for (BarCodeResult barCodeResult : barCodeResults) {
                    System.out.println(StringUtil.nullIfEmpty(barCodeResult.getCodeText()) == null ? "!!!!! ERROR !!!!!!!!!!!" : barCodeResult.getCodeText());
                    //System.out.println("Code Type : " + barCodeResult.getReadingQuality());
                }
            } else {
                System.out.println("!!!!! ERROR !!!!!!!!!!!");
            }
            reader.dispose();
        } catch (IOException ex) {
            //Logger.getLogger(JavaBar.class.getName()).log(Level.SEVERE, null, ex);
            System.out.println("!!!!! ERROR !!!!!!!!!!!");

        }

Many thanks in advance

@n.gaudin,

Please make sure that you are using latest version of Aspose.BarCode for Java v20.6. I have tested using the following sample code with your file and it works fine:
e.g
Sample code:

System.out.println("Assembly version: " + BuildVersionInfo.ASSEMBLY_VERSION);
	        System.out.println("Product: " + BuildVersionInfo.PRODUCT);
	        System.out.println("Release Date: " + BuildVersionInfo.RELEASE_DATE);
	        BarCodeReader reader;
	        try {
	            reader = new BarCodeReader(ImageIO.read(new File("f:\\files\\IMG_7974.jpg")), DecodeType.QR);
	            reader.setQualitySettings(QualitySettings.getHighQuality());
	            reader.getQualitySettings().setDetectorSettings(BarcodeSvmDetectorSettings.getHighQuality());
	            reader.getQualitySettings().setAllowDecreasedImage(true);
	            reader.getQualitySettings().setAllowMedianSmoothing(true);
	            reader.getQualitySettings().setMedianSmoothingWindowSize(4);
	            //reader.getQualitySettings().setAllowQRMicroQrRestoration(true);
	            //reader.getQualitySettings().setAllowRegularImage(false);
	            //reader.getQualitySettings().setAllowInvertImage(true);
	            //reader.getQualitySettings().setUseOldBarcodeDetector(true);

	            //System.out.println(reader.getQualitySettings().getAllowRegularImage());
	            BarCodeResult[] barCodeResults = reader.readBarCodes();
	            System.out.println(barCodeResults.length);
	            if (barCodeResults.length > 0) {
	                for (BarCodeResult barCodeResult : barCodeResults) {
	                    System.out.println(barCodeResult.getCodeText());
	         
	                }
	            } else {
	                System.out.println("!!!!! ERROR !!!!!!!!!!!");
	            }
	            reader.dispose();
	        } catch (IOException ex) {
	            System.out.println("!!!!! ERROR !!!!!!!!!!!");

	        }

Output:

Assembly version: 20.6
Product: Aspose.BarCode for Java
Release Date: Tue Jun 30 00:00:00 PKT 2020
1
http://www.fftelecoms.org/

Let us know if these are not expected results.

Hi,

Thks for your response
It is weird… here is my output

Aspose
Assembly version: 20.6
Product: Aspose.BarCode for Java
Release Date: Tue Jun 30 00:00:00 CEST 2020
0
!!! ERROR !!!

Is this due to environment issue?
We are using Java JDK 1.8.0_u151 on Windows and can not migrate to another JDK.

Also on your online demo
image.png (48.1 KB)

Thanks in advance

@n.gaudin,

It is strange that you are still getting the issue using the latest version/fix. Please make sure that you try my exact code (in the post). My JDK version is 1.8.0_191-b12 on Windows 8. Could you try your scenario with some more recent JDK version(s) or try on some other machines? Let us know if you still find the same issue.

I have exactly the same code.
I tried 1.8.0_232 (x64) on Windows 10 x64…
Same issue…:frowning:

Assembly version: 20.6
Product: Aspose.BarCode for Java
Release Date: Tue Jun 30 00:00:00 CEST 2020
0
!!! ERROR !!!

@n.gaudin,
We have tried to reproduce this issue but could not reproduce somehow. This issue is logged in our database for further investigation and we will notify you here once any feedback will be ready to share.

This issue is logged as:
BARCODEJAVA-967 - Qr Code not recognized but boofCv does