diff --git a/src/cli/add.py b/src/cli/add.py index c9f0594..374ee74 100644 --- a/src/cli/add.py +++ b/src/cli/add.py @@ -80,6 +80,12 @@ insert_model = { # Open the camera video_capture = cv2.VideoCapture(int(config.get("video", "device_id"))) + +# Force MJPEG decoding if true +if config.get("debug", "force_mjpeg") == "true": + video_capture.set(cv2.CAP_PROP_FOURCC, 1196444237) + +# Request a frame to wake the camera up video_capture.read() print("\nPlease look straight into the camera") diff --git a/src/cli/test.py b/src/cli/test.py index 191ce66..ba4b979 100644 --- a/src/cli/test.py +++ b/src/cli/test.py @@ -20,6 +20,10 @@ config.read(path + "/../config.ini") # Start capturing from the configured webcam video_capture = cv2.VideoCapture(int(config.get("video", "device_id"))) +# Force MJPEG decoding if true +if config.get("debug", "force_mjpeg") == "true": + video_capture.set(cv2.CAP_PROP_FOURCC, 1196444237) + # Let the user know what's up print(""" Opening a window with a test feed diff --git a/src/compare.py b/src/compare.py index 3a5ff02..b25e80a 100644 --- a/src/compare.py +++ b/src/compare.py @@ -60,6 +60,10 @@ timings.append(time.time()) # Start video capture on the IR camera video_capture = cv2.VideoCapture(int(config.get("video", "device_id"))) +# Force MJPEG decoding if true +if config.get("debug", "force_mjpeg") == "true": + video_capture.set(cv2.CAP_PROP_FOURCC, 1196444237) + # Capture a single frame so the camera becomes active # This will let the camera adjust its light levels while we're importing for faster scanning video_capture.read() diff --git a/src/config.ini b/src/config.ini index 213890f..146f1e8 100644 --- a/src/config.ini +++ b/src/config.ini @@ -33,6 +33,10 @@ device_id = 1 # Speeds up face recognition but can make it less precise max_height = 320 +# Force the use of Motion JPEG when decoding frames, fixes issues with +# YUYV raw frame deconding +force_mjpeg = false + # Because of flashing IR emitters, some frames can be completely unlit # Skip the frame if the lowest 1/8 of the histogram is above this percentage # of the total