pyzbar #3563
Unanswered
YasseenAlhusammi
asked this question in
Packages
pyzbar
#3563
Replies: 3 comments 1 reply
-
# using opencv
import cv2
import flet as ft
from pyzbar.pyzbar import decode, ZBarSymbol
def main(page: ft.Page):
txt_barcode_data = ft.Text()
txt_barcode_type = ft.Text()
barcode_image = ft.Image(
width=350,
height=200,
src="barcodes.png"
)
page.add(
barcode_image,
txt_barcode_data,
txt_barcode_type
)
image = cv2.imread("./assets/barcodes.png")
detected_barcodes = decode(image)
value: str = ""
data: str = ""
for barcode in detected_barcodes:
(x, y, w, h) = barcode.rect
cv2.rectangle(image, (x, y), (x + w, y + h), (255, 0, 0), 5)
value += f"{barcode.data}\r\n"
data += f"{barcode.type}\r\n"
txt_barcode_data.value = value
txt_barcode_type.value = data
txt_barcode_data.update()
txt_barcode_type.update()
ft.app(target=main, assets_dir="assets") |
Beta Was this translation helpful? Give feedback.
1 reply
-
Related discussion: #4163 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Add pyzbar to flet please
Beta Was this translation helpful? Give feedback.
All reactions