1

I'm trying to decode aztec codes from images using zxing library.

Images looks more or less like this:

https://i.stack.imgur.com/8ybYb.jpg

So far my results are quite random.

I've tried a few image processing actions using imagemagick such as:

convert -brightness-contrast 50x20 in.png out.png
convert -colorspace Gray in.png out.png

And there was improvement but still most of codes fails to decode.

What specific image preprocessing actions should I do for such barcodes ?

kamil
  • 39
  • 1
  • 6

1 Answers1

0

You can try -lat (local area threshold) in Imagemagick. For example:

Input:

enter image description here

convert barcode.png -colorspace gray -negate -lat 20x20+10% -negate result.png


enter image description here

You can improve that a little by adding -morphology close:

convert barcode.png -colorspace gray -negate -lat 20x20+10% -negate -morphology open diamond:1 result2.png


enter image description here

fmw42
  • 46,825
  • 10
  • 62
  • 80
  • Unfortunately, but there is no improvement, codes look even worse like this: https://imgur.com/a/VZJ4hDh – kamil Jan 29 '19 at 08:16
  • I do not think you have enough resolution to make any improvements. You needed to scan the bar code at a higher density. – fmw42 Jan 29 '19 at 23:09