Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent dimensions while using ByteIO as Image Object #132

Open
schui95 opened this issue Mar 26, 2022 · 0 comments
Open

Inconsistent dimensions while using ByteIO as Image Object #132

schui95 opened this issue Mar 26, 2022 · 0 comments

Comments

@schui95
Copy link

schui95 commented Mar 26, 2022

Hello everyone!

My raspberry pi with the library picamera is creating a lot of pictures and stores them as ByteIO objects.
Next step would be to decode those objects with this library pyzbar to get the qr code content.
Unfortunately the dimension is always wrong and I don't know how to fix that issue.
The pictures have the correct dimension and I guess the transformation/conversion is not correct?

My code:

`stream = BytesIO()
camera = PiCamera()
camera.resolution = (300, 300)
camera.start_preview()
camera.capture(stream, 'jpeg')

image = (stream.getbuffer(), 300, 300)
barcodes = pyzbar.decode(image, symbols=[ZBarSymbol.QRCODE])
`

Error mesage:
raise PyZbarError(pyzbar.pyzbar_error.PyZbarError: Inconsistent dimensions: image data of 4124 bytes is not divisible by (width x height = 90000)

I hope there is a solution for this problem. I assumed that pyzbar can handle this type of object, because 'raw bytes' are like ByteIO objects. A simple example on how to use this library pyzbar with raw bytes would be awesome!

Thanks for any advice or clarification!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant