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

Use pyzbar insted of zbar directly (which is python 2) #3

Open
nivb52 opened this issue Aug 31, 2021 · 2 comments
Open

Use pyzbar insted of zbar directly (which is python 2) #3

nivb52 opened this issue Aug 31, 2021 · 2 comments

Comments

@nivb52
Copy link

nivb52 commented Aug 31, 2021

One File in the repository is in python 2 and the other in python 3
How do you suppose to run in in Linux environment ?

the file detect_barcode_opencv.py is in python 3
and the file barcode_detect_and_decode.py is in python 2, due to the zbar dependency.
How do you use this library in production environment ?

@nivb52
Copy link
Author

nivb52 commented Aug 31, 2021

I changed the file and the barcode function as the following

from pyzbar.pyzbar import decode
.
.
.


def decodeBarcode(image_read):
	barcodes = decode(image_read)

	for barcode in barcodes:
		barcode_data = barcode.data.decode("utf-8")
		barcode_type = barcode.type
		# (x, y, w, h) = barcode.rect  #to get the barcode locations
		print("[INFO] Found {} barcode: {}".format(barcode_type, barcode_data ))
		# print("Location x {} y {} w {} h {}".format(x, y, w, h))
	print('-----------------------------------------------------------------------')
	del(image_read)

variable image_read is as the follow:

image_read = cv2.imread(args["image"],0) 

but you can use also the image you get after the function preprocess.

@nivb52 nivb52 changed the title One File is in python 2 and the other in python 3 Use pyzbar insted of zbar directly (which is python 2) Aug 31, 2021
@SureshbabuAkash1999
Copy link

Can we use the same method for live video as well?

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

2 participants