From 334da6e3a5357ebb12242b9e184a980124efab2c Mon Sep 17 00:00:00 2001 From: boltgolt Date: Thu, 7 Jun 2018 21:32:08 +0200 Subject: [PATCH] Fixed devision by zero issue from #44 --- src/compare.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/compare.py b/src/compare.py index a1a0869..e248983 100644 --- a/src/compare.py +++ b/src/compare.py @@ -97,6 +97,11 @@ while True: # All values combined for percentage calculation hist_total = int(sum(hist)[0]) + # If the image is fully black, skip to the next frame + if hist_total == 0: + dark_tries += 1 + continue + # Scrip the frame if it exceeds the threshold if float(hist[0]) / hist_total * 100 > float(config.get("video", "dark_threshold")): dark_tries += 1