From f4d231cca8d49e03861cb1ca3491825c38651f36 Mon Sep 17 00:00:00 2001 From: dmig Date: Tue, 11 Dec 2018 23:44:30 +0700 Subject: [PATCH] proper cam init time measuring --- src/compare.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/compare.py b/src/compare.py index 8460ec1..758cdd1 100644 --- a/src/compare.py +++ b/src/compare.py @@ -65,8 +65,7 @@ timings['st'] = time.time() - timings['st'] video_capture = None def initialize_cam(): - global video_capture, timings - timings['ic'] = time.time() + global video_capture # Start video capture on the IR camera video_capture = cv2.VideoCapture(config.get("video", "device_path")) @@ -89,9 +88,7 @@ def initialize_cam(): # This will let the camera adjust its light levels while we're importing for faster scanning video_capture.grab() - # Note the time it took to open the camera - timings['ic'] = time.time() - timings['ic'] - +timings['ic'] = time.time() init_thread = Thread(target=initialize_cam) init_thread.start() @@ -121,6 +118,8 @@ timings['ll'] = time.time() - timings['ll'] # wait for camera initialization to finish init_thread.join() del init_thread +# Note the time it took to open the camera +timings['ic'] = time.time() - timings['ic'] # Fetch the max frame height max_height = config.getfloat("video", "max_height", fallback=0.0)