ext/qrscanner/zxing/magick/src/qrscanner.cpp in qrscanner-0.1 vs ext/qrscanner/zxing/magick/src/qrscanner.cpp in qrscanner-0.2
- old
+ new
@@ -66,10 +66,11 @@
Ref<BitMatrix> matrix(NULL);
Ref<Binarizer> binarizer(NULL);
const char* result_format = "";
Image image;
+ image.density(Geometry(300,300)); // for PDFs or vector input with low, incorrect DPI set eg. some Canon scanners
try {
image.read(fname);
} catch (...) {
cerr << "Unable to open image, ignoring" << endl;
return(NULL);
@@ -77,13 +78,13 @@
try {
Ref<MagickBitmapSource> source(new MagickBitmapSource(image));
- binarizer = new HybridBinarizer(source);
-// binarizer = new GlobalHistogramBinarizer(source);
+// binarizer = new HybridBinarizer(source);
+ binarizer = new GlobalHistogramBinarizer(source);
- DecodeHints hints(DecodeHints::DEFAULT_HINT);
+ DecodeHints hints(DecodeHints::BARCODEFORMAT_QR_CODE_HINT /*DecodeHints::DEFAULT_HINT*/);
hints.setTryHarder(tryHarder);
Ref<BinaryBitmap> binary(new BinaryBitmap(binarizer));
Ref<Result> result(decode(binary, hints));
cell_result = result->getText()->getText();
result_format = barcodeFormatNames[result->getBarcodeFormat()];