diff --git a/authenticate_user.py b/authenticate_user.py index 0edc476467f8447b95a865e49bd2131ab03fd3ee..9917c66dbc41dba4c526ec18236af930f9196c71 100644 --- a/authenticate_user.py +++ b/authenticate_user.py @@ -82,7 +82,7 @@ def recognize_user(known_faces: dict, encoding_model: str = "hog", image_flip: i timeout_time: float = time.time() + TIMEOUT while time.time() < timeout_time: # Read a image_frame from the video stream. - image_frame = video_stream.read() + ret, image_frame = video_stream.read() if image_flip is not None: image_frame = cv2.flip(image_frame, image_flip) diff --git a/common.py b/common.py index e6c02f9896291a7276e4ed3ca0cbd5d890e53860..e436315ae47d4575d784d5fc49b2461dce27ae35 100644 --- a/common.py +++ b/common.py @@ -1,7 +1,4 @@ -import time - import cv2 -from imutils.video import VideoStream DATABASE_LOC = "./dataset/faces.pickle" @@ -14,6 +11,5 @@ def display_frame(frame): def start_video_stream(camera: int): """Starts the video stream and returns the created stream. Also waits for the video stream to open before returning it.""" - video_stream = VideoStream(src=camera).start() - time.sleep(2.0) + video_stream = cv2.VideoCapture(0) return video_stream