Initial commit

This commit is contained in:
David Allen 2022-12-04 11:26:52 -06:00
commit 8bde43bd49
152 changed files with 5294 additions and 0 deletions

44
client/qr_scan2.py Normal file
View file

@ -0,0 +1,44 @@
import cv2
from pyzbar import pyzbar
def read_barcodes(frame):
barcodes = pyzbar.decode(frame)
found = False
for barcode in barcodes:
x, y , w, h = barcode.rect
barcode_info = barcode.data.decode('utf-8')
cv2.rectangle(frame, (x, y),(x+w, y+h), (0, 255, 0), 2)
font = cv2.FONT_HERSHEY_DUPLEX
cv2.putText(frame, barcode_info, (x + 6, y - 6), font, 0.5, (255, 255, 255), 1)
print(barcode_info, end="")
found = len(barcode_info) != 0
return frame, found
def main() -> None:
# Set video capture
camera = cv2.VideoCapture(0)
ret, frame = camera.read()
# Run decoding until 'Esc' pressed
while ret:
ret, frame = camera.read()
frame, found = read_barcodes(frame)
cv2.imshow("", frame)
if found:
break
if cv2.waitKey(1) & 0xFF == 27:
break
# Release camera and close app
camera.release()
cv2.destroyAllWindows()
if __name__ == "__main__":
main()