File size: 651 Bytes
bd5a354 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import numpy as np
import cv2 as cv
from LicensePlateAuthorizer import LicensePlateAuthorizer
cap = cv.VideoCapture(0)
lpa = LicensePlateAuthorizer()
if not cap.isOpened():
print("Cannot open camera")
exit()
while True:
ret, frame = cap.read()
if not ret:
print("Can't receive frame (stream end?). Exiting ...")
break
processed_frame = lpa.forward(frame)
if processed_frame is None:
print("Processing error or no license plate detected. Skipping frame.")
continue
cv.imshow('frame', processed_frame)
if cv.waitKey(1) == ord('q'):
break
cap.release()
cv.destroyAllWindows() |