Reading QrCode from image

Hello,


I’m trying to read a QrCode from an image (in attachment) using the example from the website, but it can’t fint it. I would like to know if there’s a configuration I can do to help the library find it. Thanks.

The code I’m using:

BufferedImage img = ImageIOread(new File(“Reserva00038908.TIF”));
BarCodeReader reader = new BarCodeReader(img, BarCodeReadType.QR);

if (reader.read()) {
System.out.println("CodeText: " + reader.getCodeText().toString());
}


Hi Mario,

Thanks for your inquiry. I tested your provided sample image against the latest build of Aspos.BarCode for Java 5.4.2 and unable to recognize inside QR code. This problem has been logged in our bug tracking system under ticket Id BARCODJAVA-33338. We will soon investigate the cause of recognition failure. You will also be notified once the fix for your problem is available for public use.

Please accept our apologies for your inconvenience.

Hello, thanks for the answer.

That's a huge problem... isn't there a "try harder" mode or some hints I can pass to the read method to help?

I'm trying to find a reliable library to read QrCodes and I'm hoping Aspose can be the one, today I am having a lot of problems with this.

Thank you again.

Hi Mario,

Thanks for your inquiry and sorry for the delayed response. I would like to update you that Aspose.BarCode for Java provides better and faster bar code recognition using image processing techniques and it also contains the support to rotate bar code before passed in recognition. Please visit the documentation links below:
http://www.aspose.com/docs/display/barcodejava/Better+and+Faster+Image+Processing+for+BarCode+Recognition
http://www.aspose.com/docs/display/barcodenet/Barcode+Orientation

In your case, these techniques are not helpful and it is difficult to say anything prior to the preliminary investigation. Furthermore, please note that there are several other factors contributing in scan failure, like presence of noise in the image, skewed bar code labels, punch holes/white spots etc. Severity of one such factor or a combination of two or more makes it difficult for the BarCodeRecognition algorithm to scan a bar code properly. So please spare us a bit more time.

Please let me know in case of further assistance or questions.

Hi Mario,

We have a good news for you is BARCODJAVA-33338 has now been resolved and its fix will be included in the next version of Aspose.BarCode for Java 5.7.0. We will inform you via this forum thread as soon as the new release is published.

Thank you!


I have another problem now that I don’t know if it’s also fixed on that release, the library can’t decode the image attached.

The think is, this image is generated by another program, and I can put it any size I want, and I’m now fighting with sizes: this image for instance can’t be read with 102x102 but if I change it to 100x100 the library is able to decode it.

Is there anything I can do to generate images that are able to be read 100% of the time?

Thank you again.

Hi Mario,


Thanks for your inquiry. I managed to replicate the problem. I have logged this issue under ticket id BARCODJAVA-33391 in our issue tracking system. Your request has also been linked to this issue. We will let you know once it is fixed. We’re sorry for your inconvenience.

Hi Mario,

From the specifics of ticket id BARCODJAVA-33338, this issue is pending because the compressor is not available for this image and its availability is related to another feature. Meanwhile, as a workaround, you can export it to any other file format for example bmp and then you can recognize QR code by using the latest release of Aspose.BarCode 5.6.2.0. You can download this release from here .

Furthermore, you can download the latest release of Aspose.Imaging 1.8.0 from here. In order to export tif file to any other file format. Please a look over these helping links:

http://www.aspose.com/docs/display/imagingjava/Exporting+Images+to+Bitmap+Formats

http://www.aspose.com/docs/display/imagingjava/Applying+the+License

Please try the following source code below:

[Java]

String fileName = “Reserva00038845.bmp”;

BarCodeReader reader = **new** BarCodeReader("C:\\temp\\ " + fileName, BarCodeReadType.QR);

reader.setOrientationHints(com.aspose.barcoderecognition.Orientation.Rotate90);

while (reader.read())

{

System.out .println(fileName + " codetext: " + reader.getCodeText());

}

reader.close();

Please do let me know in case of any confusion or questions.

Hi Mario,


We have a good news for you is BARCODJAVA-33391 has now been resolved and its fix will be included in the next version of Aspose.BarCode for Java 5.8.0. Its release date is not final yet. We will inform you via this forum thread as soon as the new release is published.

Hi Imran,


is there a date for the release of the next version yet?

I am sending more examples of not read QrCodes, I really need to be able to decode all of them.

Thanks.
Hi Mario,

Thank you for sharing problematic images. I managed to replicate the problem of recognition failure. I have logged this issue under ticket id BARCODJAVA-33413 in our issue tracking system. Your request has also been linked to this issue and you will be notified as soon as it is fixed. We're sorry for your inconvenience.

Second, I have asked the responsible development team to share an estimate regarding Aspose.BarCode for Java 5.8.0 release. I shall get back to you once any information is shared by them.

Hi Mario,

Thank you for being patient. I have received a response from our development team. I would like to update you that Aspose.BarCode for Java 5.8.0 will be released at the end of December 2013. We will let you know once the release is published.

Hello Imran,


is there any news on the new version?

Thanks.

Hi Mario,


Thank you for your inquiry. It is currently in-progress. Our development team is working hard to deliver the new release of Aspose.BarCode 5.8.0. You will be notified as soon as it is published. We’re sorry for your inconvenience.

The issues you have found earlier (filed as BARCODJAVA-33391) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as BARCODJAVA-33338) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hello, thanks for the fixes but I find another image that couldn’t be read.


It’s in attachment, please take a look.

Hi Mario,


Thank you for sharing this problematic barcode image. I managed to replicate the problem of recognition failure. I have logged this problem under ticket id BARCODJAVA-33437 in our issue tracking system. Your request has also been linked to this issue and you will be notified as soon as it is fixed. We’re sorry for your inconvenience.

Hello,


here are more examples of problematic images. This is becoming a serious issue here, can’t it be fixed to this format of image so it won’t happen again?

[]'s

Hi Mario,

Thank you for your inquiry. I’ve tested your sample barcode images against the latest build Aspose.BarCode for Java 5.8.0. I can recognize all these QR codes except one (DOC+1±+172.124.jpg). Please take a look over the sample code:

String strBasePath = “c:/temp/”;

ArrayList strFiles = new ArrayList();

strFiles.add(strBasePath + “DOC+01-172.121.14.jpg”);

strFiles.add(strBasePath + “DOC+1-172.121.7.jpg”);

strFiles.add(strBasePath + “DOC+1-172.121.14.jpg”);

strFiles.add(strBasePath + “DOC+2-172.121.8.jpg”);

strFiles.add(strBasePath + “DOC+12±+172.145.jpg”);

strFiles.add(strBasePath + “DOC+13±+172.145.jpg”);

for (int i=0 ; i<strFiles.size() ; i++)

{

String fileName = strFiles.get(i);

BarCodeReader reader = new BarCodeReader(fileName, BarCodeReadType.QR );

while (reader.read())

{

System.out .println(fileName + " codetext: " + reader.getCodeText());

}

reader.close();

}

Results:

C:/temp/DOC+01-172.121.14.jpg codetext: McCode={LTE=183

CLI=03745549783,00907190774

SPE=20322953

EMP=20322935

BLC=BLOCO 02 - LOTE 04

UNI=412

TPO=172.121.14}

C:/temp/DOC+1-172.121.7.jpg codetext: McCode={LTE=235

CLI=83853677720,91918782768

SPE=20322999

EMP=20322969

BLC=BLOCO 04

UNI=501

TPO=172.121.7}

C:/temp/DOC+1-172.121.14.jpg codetext: McCode={LTE=266

CLI=08241073739,08556827799

SPE=20461961

EMP=20461931

BLC=BLOCO 02

UNI=1003

TPO=172.121.14}

C:/temp/DOC+2-172.121.8.jpg codetext: McCode={LTE=263

CLI=84234130710

SPE=20461961

EMP=20461931

BLC=BLOCO 02

UNI=307

TPO=172.121.8}

C:/temp/DOC+12±+172.145.jpg codetext: McCode={LTE=264

CLI=92686214791,02237587795

SPE=20461961

EMP=20461931

BLC=BLOCO 03

UNI=502

TPO=172.145}

C:/temp/DOC+13±+172.145.jpg codetext: McCode={LTE=312

CLI=09112058700,09164175731

SPE=20461961

EMP=20461931

BLC=BLOCO 04

UNI=1001

TPO=172.145}

I can also recognize the barcode image DOC+1±+172.124.jpg with orientation angle 90 whereas it is actually not rotated. I’ve logged this problem under ticket id BARCODJAVA-33440 in our issue tracking system. Your request has also been linked to this issue. We’ll let you know once a significant progress has been made. We’re sorry for your inconvenience.