From f47585fb681672c27983ead177920c93bc40af2a Mon Sep 17 00:00:00 2001 From: Mikolaj Date: Tue, 7 Jan 2020 21:01:19 +0100 Subject: [PATCH] cm --- scan_webcam.py | 58 +++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/scan_webcam.py b/scan_webcam.py index a80ca76..2bfc8e1 100644 --- a/scan_webcam.py +++ b/scan_webcam.py @@ -1,29 +1,29 @@ -import cv2 -import numpy as np -import pyzbar.pyzbar as pyzbar -import webbrowser - - -cap = cv2.VideoCapture(0) -font = cv2.FONT_HERSHEY_PLAIN - - -while True: - _, frame = cap.read() - - decodedObjects = pyzbar.decode(frame) - for obj in decodedObjects: - #print("Data", obj.data) - cv2.putText(frame, str(obj.data), (50, 50), font, 2, # POKAŻ NA EKRAN NAPIS Z LINKU KODU QR - (255, 0, 0), 3) - - webbrowser.open(obj.data, new=2) # OTWÓŻ PRZEGLĄDARKĘ, WYŚWIETL LINK Z KODU QR - - - cv2.imshow("Frame", frame) - - key = cv2.waitKey(1) - if key == 27: - break - - +import cv2 +import numpy as np +import pyzbar.pyzbar as pyzbar +import webbrowser + + +cap = cv2.VideoCapture(0) # PRZCHYWĆ OBRAZ +font = cv2.FONT_HERSHEY_PLAIN + + +while True: + _, frame = cap.read() #CZYTAJ OBRAZ Z OKNA + + decodedObjects = pyzbar.decode(frame) + for obj in decodedObjects: + + cv2.putText(frame, str(obj.data), (50, 50), font, 2, # POKAŻ NA EKRAN NAPIS Z LINKU KODU QR + (255, 0, 0), 3) + + webbrowser.open(obj.data, new=2) # OTWÓRZ PRZEGLĄDARKĘ + + + cv2.imshow("Frame", frame) # WYŚWIETL OBRAZ W OKNIE + + key = cv2.waitKey(1) & 0xFF == ord('q') #CZEKAJ NA OBRAZ + if key == 27: + break + +