commit
30728a6d36
7 changed files with 19 additions and 18 deletions
|
|
@ -44,7 +44,7 @@ def on_page_switch(self, notebook, page, page_num):
|
||||||
if width * self.scaling_factor > MAX_WIDTH:
|
if width * self.scaling_factor > MAX_WIDTH:
|
||||||
self.scaling_factor = (MAX_WIDTH / width) or 1
|
self.scaling_factor = (MAX_WIDTH / width) or 1
|
||||||
|
|
||||||
config_height = self.config.getfloat("video", "max_height", fallback=0.0)
|
config_height = self.config.getfloat("video", "max_height", fallback=320.0)
|
||||||
config_scaling = (config_height / height) or 1
|
config_scaling = (config_height / height) or 1
|
||||||
|
|
||||||
self.builder.get_object("videoid").set_text(path.split("/")[-1])
|
self.builder.get_object("videoid").set_text(path.split("/")[-1])
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ dark_tries = 0
|
||||||
dark_running_total = 0
|
dark_running_total = 0
|
||||||
face_locations = None
|
face_locations = None
|
||||||
|
|
||||||
dark_threshold = config.getfloat("video", "dark_threshold")
|
dark_threshold = config.getfloat("video", "dark_threshold", fallback=60)
|
||||||
|
|
||||||
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8))
|
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,13 +35,13 @@ else:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Don't do anything when the state is already the requested one
|
# Don't do anything when the state is already the requested one
|
||||||
if out_value == config.get("core", "disabled"):
|
if out_value == config.get("core", "disabled", fallback=True):
|
||||||
print(_("The disable option has already been set to ") + out_value)
|
print(_("The disable option has already been set to ") + out_value)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Loop though the config file and only replace the line containing the disable config
|
# Loop though the config file and only replace the line containing the disable config
|
||||||
for line in fileinput.input([config_path], inplace=1):
|
for line in fileinput.input([config_path], inplace=1):
|
||||||
print(line.replace("disabled = " + config.get("core", "disabled"), "disabled = " + out_value), end="")
|
print(line.replace("disabled = " + config.get("core", "disabled", fallback=True), "disabled = " + out_value), end="")
|
||||||
|
|
||||||
# Print what we just did
|
# Print what we just did
|
||||||
if out_value == "true":
|
if out_value == "true":
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ video_capture.read_frame()
|
||||||
|
|
||||||
# Read exposure and dark_thresholds from config to use in the main loop
|
# Read exposure and dark_thresholds from config to use in the main loop
|
||||||
exposure = config.getint("video", "exposure", fallback=-1)
|
exposure = config.getint("video", "exposure", fallback=-1)
|
||||||
dark_threshold = config.getfloat("video", "dark_threshold")
|
dark_threshold = config.getfloat("video", "dark_threshold", fallback=60)
|
||||||
|
|
||||||
# COllection of recorded frames
|
# COllection of recorded frames
|
||||||
frames = []
|
frames = []
|
||||||
|
|
@ -43,7 +43,7 @@ while True:
|
||||||
file = snapshot.generate(frames, [
|
file = snapshot.generate(frames, [
|
||||||
_("GENERATED SNAPSHOT"),
|
_("GENERATED SNAPSHOT"),
|
||||||
_("Date: ") + datetime.datetime.utcnow().strftime("%Y/%m/%d %H:%M:%S UTC"),
|
_("Date: ") + datetime.datetime.utcnow().strftime("%Y/%m/%d %H:%M:%S UTC"),
|
||||||
_("Dark threshold config: ") + str(config.getfloat("video", "dark_threshold", fallback=50.0)),
|
_("Dark threshold config: ") + str(config.getfloat("video", "dark_threshold", fallback=60.0)),
|
||||||
_("Certainty config: ") + str(config.getfloat("video", "certainty", fallback=3.5))
|
_("Certainty config: ") + str(config.getfloat("video", "certainty", fallback=3.5))
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ path = "/etc/howdy"
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(path + "/config.ini")
|
config.read(path + "/config.ini")
|
||||||
|
|
||||||
if config.get("video", "recording_plugin") != "opencv":
|
if config.get("video", "recording_plugin", fallback="opencv") != "opencv":
|
||||||
print(_("Howdy has been configured to use a recorder which doesn't support the test command yet, aborting"))
|
print(_("Howdy has been configured to use a recorder which doesn't support the test command yet, aborting"))
|
||||||
sys.exit(12)
|
sys.exit(12)
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ video_capture = VideoCapture(config)
|
||||||
# Read config values to use in the main loop
|
# Read config values to use in the main loop
|
||||||
video_certainty = config.getfloat("video", "certainty", fallback=3.5) / 10
|
video_certainty = config.getfloat("video", "certainty", fallback=3.5) / 10
|
||||||
exposure = config.getint("video", "exposure", fallback=-1)
|
exposure = config.getint("video", "exposure", fallback=-1)
|
||||||
dark_threshold = config.getfloat("video", "dark_threshold")
|
dark_threshold = config.getfloat("video", "dark_threshold", fallback=60)
|
||||||
|
|
||||||
# Let the user know what's up
|
# Let the user know what's up
|
||||||
print(_("""
|
print(_("""
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ config.read(PATH + "/config.ini")
|
||||||
|
|
||||||
# Get all config values needed
|
# Get all config values needed
|
||||||
use_cnn = config.getboolean("core", "use_cnn", fallback=False)
|
use_cnn = config.getboolean("core", "use_cnn", fallback=False)
|
||||||
timeout = config.getint("video", "timeout", fallback=5)
|
timeout = config.getint("video", "timeout", fallback=4)
|
||||||
dark_threshold = config.getfloat("video", "dark_threshold", fallback=50.0)
|
dark_threshold = config.getfloat("video", "dark_threshold", fallback=50.0)
|
||||||
video_certainty = config.getfloat("video", "certainty", fallback=3.5) / 10
|
video_certainty = config.getfloat("video", "certainty", fallback=3.5) / 10
|
||||||
end_report = config.getboolean("debug", "end_report", fallback=False)
|
end_report = config.getboolean("debug", "end_report", fallback=False)
|
||||||
|
|
@ -196,7 +196,7 @@ lock.release()
|
||||||
del lock
|
del lock
|
||||||
|
|
||||||
# Fetch the max frame height
|
# Fetch the max frame height
|
||||||
max_height = config.getfloat("video", "max_height", fallback=0.0)
|
max_height = config.getfloat("video", "max_height", fallback=320.0)
|
||||||
|
|
||||||
# Get the height of the image (which would be the width if screen is portrait oriented)
|
# Get the height of the image (which would be the width if screen is portrait oriented)
|
||||||
height = video_capture.internal.get(cv2.CAP_PROP_FRAME_HEIGHT) or 1
|
height = video_capture.internal.get(cv2.CAP_PROP_FRAME_HEIGHT) or 1
|
||||||
|
|
@ -206,9 +206,9 @@ if rotate == 2:
|
||||||
scaling_factor = (max_height / height) or 1
|
scaling_factor = (max_height / height) or 1
|
||||||
|
|
||||||
# Fetch config settings out of the loop
|
# Fetch config settings out of the loop
|
||||||
timeout = config.getint("video", "timeout")
|
timeout = config.getint("video", "timeout", fallback=4)
|
||||||
dark_threshold = config.getfloat("video", "dark_threshold")
|
dark_threshold = config.getfloat("video", "dark_threshold", fallback=60)
|
||||||
end_report = config.getboolean("debug", "end_report")
|
end_report = config.getboolean("debug", "end_report", fallback=False)
|
||||||
|
|
||||||
# Initiate histogram equalization
|
# Initiate histogram equalization
|
||||||
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8))
|
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8))
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class VideoCapture:
|
||||||
|
|
||||||
# Check device path
|
# Check device path
|
||||||
if not os.path.exists(self.config.get("video", "device_path")):
|
if not os.path.exists(self.config.get("video", "device_path")):
|
||||||
if self.config.getboolean("video", "warn_no_device"):
|
if self.config.getboolean("video", "warn_no_device", fallback=True):
|
||||||
print(_("Howdy could not find a camera device at the path specified in the config file."))
|
print(_("Howdy could not find a camera device at the path specified in the config file."))
|
||||||
print(_("It is very likely that the path is not configured correctly, please edit the 'device_path' config value by running:"))
|
print(_("It is very likely that the path is not configured correctly, please edit the 'device_path' config value by running:"))
|
||||||
print("\n\tsudo howdy config\n")
|
print("\n\tsudo howdy config\n")
|
||||||
|
|
@ -100,21 +100,22 @@ class VideoCapture:
|
||||||
"""
|
"""
|
||||||
Sets up the video reader instance
|
Sets up the video reader instance
|
||||||
"""
|
"""
|
||||||
|
recording_plugin = self.config.get("video", "recording_plugin", fallback="opencv")
|
||||||
|
|
||||||
if self.config.get("video", "recording_plugin") == "ffmpeg":
|
if recording_plugin == "ffmpeg":
|
||||||
# Set the capture source for ffmpeg
|
# Set the capture source for ffmpeg
|
||||||
from recorders.ffmpeg_reader import ffmpeg_reader
|
from recorders.ffmpeg_reader import ffmpeg_reader
|
||||||
self.internal = ffmpeg_reader(
|
self.internal = ffmpeg_reader(
|
||||||
self.config.get("video", "device_path"),
|
self.config.get("video", "device_path"),
|
||||||
self.config.get("video", "device_format")
|
self.config.get("video", "device_format", fallback="v4l2")
|
||||||
)
|
)
|
||||||
|
|
||||||
elif self.config.get("video", "recording_plugin") == "pyv4l2":
|
elif recording_plugin == "pyv4l2":
|
||||||
# Set the capture source for pyv4l2
|
# Set the capture source for pyv4l2
|
||||||
from recorders.pyv4l2_reader import pyv4l2_reader
|
from recorders.pyv4l2_reader import pyv4l2_reader
|
||||||
self.internal = pyv4l2_reader(
|
self.internal = pyv4l2_reader(
|
||||||
self.config.get("video", "device_path"),
|
self.config.get("video", "device_path"),
|
||||||
self.config.get("video", "device_format")
|
self.config.get("video", "device_format", fallback="v4l2")
|
||||||
)
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue