pyzbar #3563
Replies: 5 comments 2 replies
-
# 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.
-
Related discussion: #4163 |
Beta Was this translation helpful? Give feedback.
-
I don't know what I did. I built and the build succeeded as in the following link: |
Beta Was this translation helpful? Give feedback.
-
I have successfully built the library as in the project: https://github.com/yasseenalhusammin/build-lib-native and the build results were as in the attachment https://github.com/yasseenalhusammin/build-lib-native/actions/runs/13710454805/artifacts/2707673124 as follows: Now I want to know how to include the build results (ready library) within the flet project, is there any help in this aspect? I want the flet build apk to succeed with the inclusion of the ready library. |
Beta Was this translation helpful? Give feedback.
-
Add pyzbar to flet please
Beta Was this translation helpful? Give feedback.
All reactions