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

Pyzbar has problems with detecting multiple barcodes #166

Open
Underest opened this issue Oct 28, 2024 · 0 comments
Open

Pyzbar has problems with detecting multiple barcodes #166

Underest opened this issue Oct 28, 2024 · 0 comments

Comments

@Underest
Copy link

Im using pyzbar to detect and decode barcodes in an jpg.
This jpg has multiple barcodes, but I need the Code128 one.
However, pyzbar only detects a sinlge barcode (its a Code39).
I have to cover the other barcode, in oder to detect the Code128 one.
I also tried to set the symbols argument to Code128, but doesnt work.

The original image:
2

The image with the covered barcode:
2_test

This is my code:

import cv2
import PIL.Image
import pyzbar.pyzbar as pyzbar

im = PIL.Image.open("2.jpg")
decoded = pyzbar.decode(im)
print(decoded)
im = PIL.Image.open("2.jpg")
decoded = pyzbar.decode(im,symbols=[pyzbar.ZBarSymbol.CODE128])
print(decoded)
im = PIL.Image.open("2_test.jpg")
decoded = pyzbar.decode(im)
print(decoded)

and Im getting following result:
[Decoded(data=b'0002', type='CODE39', rect=Rect(left=143, top=3296, width=6, height=0), polygon=[Point(x=143, y=3296), Point(x=149, y=3296)], quality=2, orientation='LEFT')]
[]
[Decoded(data=b'MO24-000830-1', type='CODE128', rect=Rect(left=154, top=6381, width=52, height=0), polygon=[Point(x=154, y=6381), Point(x=206, y=6381)], quality=10, orientation='LEFT')]

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