Hello!
This is my first contact with ZXing Library and I am trying to create an application (in future working on Android, currently on Win7 PC) for extracting data from QRCodes and processing it. So basically my goal is to extract the code about QRCodes and on that basis create my own application.
As for the "creating codes" part, everything went ok so far. But I've encountered a small problem in "extract data" part of the code.
Here's the thing:
I've written a simple test to grab the general concept of the code, basing on the Developer Notes (
http://code.google.com/p/zxing/wiki/DeveloperNotes ):
/* necessery imports */
public class Test {
public static void main(String[] args) throws Exception {
BufferedImage img = ImageIO.read(new File("qrcode_sample.jpg"));
LuminanceSource source = new BufferedImageLuminanceSource(img);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Reader reader = new QRCodeReader();
Result result = reader.decode(bitmap);
System.out.println(result.getText());
}
}
The debugger threw NotFoundException from that part of the code:
File: FinderPatternFinder.java
...
private FinderPattern[] selectBestPatterns() throws NotFoundException {
int startSize = possibleCenters.size();
if (startSize < 3) {
// Couldn't find enough finder patterns
throw NotFoundException.getNotFoundInstance();
}
...
In my understanding of that exception, the application can't find those three corner-markers in the qrcode_sample.jpg image. But I've tried many images, from camera, from internet and even perfectly formed QRCodes created in paint. Nevertheless, I've still failed to achieve a single string with information. Can you help me with finding the anwser?
Generally speaking all I need to have are the means to:
-scan an image from the phone's camera
-read the qrcode from the image
-extract text data from the qrcode
The rest will be handled by my code. No sharing, no database saving, no other code formats than QR. Thank you for your help.
Mateusz