New issue 1144 by speed1...@gmail.com: add option to decode qr only (patch
submission)
http://code.google.com/p/zxing/issues/detail?id=1144
I have a patch here that allows the option to scan for qr codes only. This
is helpful because sometimes when scanning an entire page (intending to
find a qr code) a false positive is returned because of the lines elsewhere
on the page (the scanner thinks it found a UPC or other barcode).
I have been using this hack since version 1.6 and after patching the latest
svn rev I thought I'd share.
The qronly.patch is the entire output of 'svn diff' and the other two are
split out versions of the same thing.
Attachments:
qronly.patch 3.8 KB
Config.java.patch 762 bytes
CommandLineRunner.java.patch 3.1 KB
Comment #1 on issue 1144 by srowen: add option to decode qr only (patch
submission)
http://code.google.com/p/zxing/issues/detail?id=1144
I think we'd soon have 20 options for all possibilities, how about one new
flag that lets you specify the exact formats you want?
We have no database.
I'll see what I can do to get a flag in place. That does sound like a more
elegant option ;)
OK, I had time to get this roughed in. It's not as pretty as I'd like,
but I'm not a java pro...
Here's the breakdown.
new option is --barcode_type=
barcode type is specified with the names in the
you can add more than one with a comma(such as
--barcode_type=DATAMATRIX,UPC_A
I wanted to have the options build dynamically based on the string passed
in but for now it's just a series of ifs
I put it in a for loop format to make it easier to accomodate if someone
knows a good way to have it loop through bcTypes[i] inserting the
appropriate vector.add lines
Attachments:
all.patch 5.0 KB
CommandLineRunner.java.patch 4.6 KB
Config.java.patch 821 bytes
You can make this code much simpler because you can parse a string
like "UPC_A" to the BarcodeFormat object using its valueOf() method.
Surely Config should have one property, a List<BarcodeFormat> rather than
String[], and perhaps call it getBarcodeFormats()?