Page 1 of 1
QR code cleaning after scan
Posted: 2013-12-17T04:40:40-07:00
by sucotronic
I've developed a script to process scanned documents that carry a QR code on them. When the original is scanned, I apply median 2 and noise 2 and the QR decoding library (zxing more used for android), and normally it decodes ok. The problem is when somebody scan a not original document. I've tried to vary values of median an noise, but the qr library is not able to indentify it. Any tips in additional parameter to get better results?
Here are my tests so far:

Re: QR code cleaning after scan
Posted: 2013-12-17T10:48:49-07:00
by fmw42
try using -threshold and -morphology
convert test.png -threshold 75% -morphology open square:1 result.png
see
http://www.imagemagick.org/Usage/morphology/
Or try multiple iterations of -despeckle (and possible threshold afterwards)
convert test.png -despeckle -despeckle -despeckle -despeckle -despeckle -despeckle -despeckle -despeckle -despeckle result.png
see
http://www.imagemagick.org/script/comma ... #despeckle
If on linux/mac osx or windows with Cygwin, for automatic thresholding try my scripts, otsuthresh or kmeansthresh or isodatathresh. See my link below.
Re: QR code cleaning after scan
Posted: 2013-12-18T01:26:21-07:00
by sucotronic
fmw42 wrote:try using -threshold and -morphology
convert test.png -threshold 75% -morphology open square:1 result.png
see
http://www.imagemagick.org/Usage/morphology/
Or try multiple iterations of -despeckle (and possible threshold afterwards)
convert test.png -despeckle -despeckle -despeckle -despeckle -despeckle -despeckle -despeckle -despeckle -despeckle result.png
see
http://www.imagemagick.org/script/comma ... #despeckle
If on linux/mac osx or windows with Cygwin, for automatic thresholding try my scripts, otsuthresh or kmeansthresh or isodatathresh. See my link below.
Thanks! I also have to add -scale 30% because it seems that the QR decoding engine works better with small images instead of full 300dpi A4 scans
