From 7b835b26b4ed6bbd4f52a1686bc87963abab5f9c Mon Sep 17 00:00:00 2001 From: chaol Date: Mon, 21 Aug 2023 13:31:10 +0800 Subject: [PATCH 1/4] Fix: "name 'os' is not defined" fault in preinst --- howdy/debian/preinst | 1 + 1 file changed, 1 insertion(+) diff --git a/howdy/debian/preinst b/howdy/debian/preinst index 2318c92..a29bbb6 100755 --- a/howdy/debian/preinst +++ b/howdy/debian/preinst @@ -4,6 +4,7 @@ import subprocess import sys +import os # Backup the config file if we're upgrading if "upgrade" in sys.argv: From ab82274a33e791229034eb07a900b0987aa5b00d Mon Sep 17 00:00:00 2001 From: chaol Date: Mon, 21 Aug 2023 14:20:40 +0800 Subject: [PATCH 2/4] Fix wrong config path --- howdy/src/cli/disable.py | 2 +- howdy/src/cli/set.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/howdy/src/cli/disable.py b/howdy/src/cli/disable.py index be78c97..e6b635d 100644 --- a/howdy/src/cli/disable.py +++ b/howdy/src/cli/disable.py @@ -10,7 +10,7 @@ import configparser from i18n import _ # Get the absolute filepath -config_path = os.path.dirname("/etc/howdy") + "/config.ini" +config_path = os.path.dirname("/etc/howdy/") + "/config.ini" # Read config from disk config = configparser.ConfigParser() diff --git a/howdy/src/cli/set.py b/howdy/src/cli/set.py index 14d15c2..0f36817 100644 --- a/howdy/src/cli/set.py +++ b/howdy/src/cli/set.py @@ -9,7 +9,7 @@ import fileinput from i18n import _ # Get the absolute filepath -config_path = os.path.dirname("/etc/howdy") + "/config.ini" +config_path = os.path.dirname("/etc/howdy/") + "/config.ini" # Check if enough arguments have been passed if len(builtins.howdy_args.arguments) < 2: From ef60fa519c30c5b8450da36151dac9c6b9457549 Mon Sep 17 00:00:00 2001 From: Anton Golubev Date: Mon, 28 Aug 2023 14:03:11 +0300 Subject: [PATCH 3/4] Ensure Model ID is unique The ID of the newly created model was obtained as the length of the array of models, but if some models "in the middle" were deleted, the new ID could be the same as the existing one. We are sure that the last ID is the maximum, so we just take +1 than the last element. --- howdy/src/cli/add.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/howdy/src/cli/add.py b/howdy/src/cli/add.py index 7a6d9ec..8baa0f1 100644 --- a/howdy/src/cli/add.py +++ b/howdy/src/cli/add.py @@ -78,13 +78,16 @@ if not builtins.howdy_args.plain: # Set the default label label = "Initial model" +# some id's can be skipped, but the last id is always the maximum +next_id = encodings[-1]["id"] + 1 if encodings else 0 + # Get the label from the cli arguments if provided if builtins.howdy_args.arguments: label = builtins.howdy_args.arguments[0] -# If models already exist, set that default label -elif encodings: - label = _("Model #") + str(len(encodings) + 1) +# Or set the default label +else: + label = _("Model #") + str(next_id) # Keep de default name if we can't ask questions if builtins.howdy_args.y: @@ -106,7 +109,7 @@ if "," in label: insert_model = { "time": int(time.time()), "label": label, - "id": len(encodings), + "id": next_id, "data": [] } From d6e35cfd1de3ffcff6fd22e0ec5e7e10fae440e0 Mon Sep 17 00:00:00 2001 From: Joseph DiGiovanni Date: Tue, 29 Aug 2023 23:01:29 -0400 Subject: [PATCH 4/4] Add configurable device frame rate --- howdy/src/config.ini | 6 ++++++ howdy/src/recorders/video_capture.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/howdy/src/config.ini b/howdy/src/config.ini index 27ab823..789347a 100644 --- a/howdy/src/config.ini +++ b/howdy/src/config.ini @@ -86,6 +86,12 @@ force_mjpeg = false # OPENCV only. exposure = -1 +# Specify frame rate of the capture device. +# Some IR emitters will not function properly at the default framerate. +# Use qv4l2 to determine an appropriate value. +# OPENCV only. +device_fps = -1 + # Rotate captured frames so faces are upright. # 0 Check landscape orientation only # 1 Check both landscape and portrait orientation diff --git a/howdy/src/recorders/video_capture.py b/howdy/src/recorders/video_capture.py index d8552e7..15888a5 100644 --- a/howdy/src/recorders/video_capture.py +++ b/howdy/src/recorders/video_capture.py @@ -124,6 +124,12 @@ class VideoCapture: self.config.get("video", "device_path"), cv2.CAP_V4L ) + # Set the capture frame rate + # Without this the first detected (and possibly lower) frame rate is used, -1 seems to select the highest + # Use 0 as a fallback to avoid breaking an existing setup, new installs should default to -1 + self.fps = self.config.getint("video", "device_fps", fallback=0) + if self.fps != 0: + self.internal.set(cv2.CAP_PROP_FPS, self.fps) # Force MJPEG decoding if true if self.config.getboolean("video", "force_mjpeg", fallback=False):