質問

I've got scanned image files that I perform some preprocessing on and get them looking something like this:

QR Code Image

My phone's ZBar app can read this QR code fine, but zbarimg seems to be unable to figure it out. I've tried all sorts of things in ImageMagick to make it smoother (-smooth, -morphology) but even with slightly better-looking results, zbarimg still comes up blank.

Why would my phone's ZBar be so much better than my computer's (zbar-0.10)? Is there anything I can do to get zbarimg to read this successfully?

役に立ちましたか?

解決

You can try morphological closing.

Python code:

# -*- coding: utf-8 -*-
import qrtools
import cv2
import numpy as np

imgPath = "Fdnm1.png"

img = cv2.imread(imgPath, 0)
kernel = np.ones((5, 5), np.uint8)
processed=cv2.morphologyEx(img, cv2.MORPH_CLOSE, kernel)
cv2.imwrite('test.png', processed)
d = qrtools.QR(filename='test.png')
d.decode()
print d.data

Result:

1MB24
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top