Skip to content

Commit

Permalink
pixel_val_threshold on motion detection was being ignored. (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
robotrapta authored Sep 18, 2024
1 parent 79bbacd commit 09e7f98
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/framegrab/motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def __init__(self, pct_threshold: float = 1, val_threshold: int = 50) -> bool:
:param pct_threshold: Percent of pixels needed to change before motion is detected
"""
self.unused = True
self.threshold = 50
self.pixel_val_threshold = 50
self.pixel_val_threshold = val_threshold
self.pixel_pct_threshold = pct_threshold
self.log_pixel_percent = True

Expand Down Expand Up @@ -48,8 +47,8 @@ def motion_detected(self, new_img: np.ndarray) -> bool:
if new_img16.shape != self.base_img.shape:
return True

diff1 = np.abs(new_img16 - self.base_img) > self.threshold
diff2 = np.abs(new_img16 - self.base2) > self.threshold
diff1 = np.abs(new_img16 - self.base_img) > self.pixel_val_threshold
diff2 = np.abs(new_img16 - self.base2) > self.pixel_val_threshold

self.base2 = self.base_img
self.base_img = new_img
Expand Down

0 comments on commit 09e7f98

Please sign in to comment.