Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

computer vision - Order of QR Decoding Using pyzbar in Python

I've been working on a program that opens an image and prints the decoded information of one or more QR codes. The code works and I can decode all of the QR codes, but the order is not what I expected it would be. As order does matter for the final program, I was wondering if anyone could help me determine how the decode searches through the picture for the codes (top to bottom, left to right, etc.). The following is the code that I use to find the QR codes:

from pyzbar.pyzbar import decode
from PIL import Image

img3 = Image.open('test4.jpg')
img3 = img3.rotate(270)
#img3.show()
result3 = decode(img3)
print(result3)
for i in result3:
    print(i.data.decode("utf-8"))

In this case, the image shows QR code 1 and QR code 2 with QR1 on top and QR2 on the bottom. The whole image is sideways, so I rotated the image 270 degrees to get it to be right side up. It prints QR2 then QR1, but it doesn't seem to matter which way I rotate it, it always returns QR2 then QR1


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...