Commit ade475ba authored by Kyle Anderson's avatar Kyle Anderson

Use different video stream

Now using the cv2 video stream instead of the imUtils one, since it seems to be a little less latent.
parent 04489fd1
...@@ -82,7 +82,7 @@ def recognize_user(known_faces: dict, encoding_model: str = "hog", image_flip: i ...@@ -82,7 +82,7 @@ def recognize_user(known_faces: dict, encoding_model: str = "hog", image_flip: i
timeout_time: float = time.time() + TIMEOUT timeout_time: float = time.time() + TIMEOUT
while time.time() < timeout_time: while time.time() < timeout_time:
# Read a image_frame from the video stream. # 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: if image_flip is not None:
image_frame = cv2.flip(image_frame, image_flip) image_frame = cv2.flip(image_frame, image_flip)
......
import time
import cv2 import cv2
from imutils.video import VideoStream
DATABASE_LOC = "./dataset/faces.pickle" DATABASE_LOC = "./dataset/faces.pickle"
...@@ -14,6 +11,5 @@ def display_frame(frame): ...@@ -14,6 +11,5 @@ def display_frame(frame):
def start_video_stream(camera: int): def start_video_stream(camera: int):
"""Starts the video stream and returns the created stream. """Starts the video stream and returns the created stream.
Also waits for the video stream to open before returning it.""" Also waits for the video stream to open before returning it."""
video_stream = VideoStream(src=camera).start() video_stream = cv2.VideoCapture(0)
time.sleep(2.0)
return video_stream return video_stream
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment