Skip to content

Commit

Permalink
Merge pull request #8 from groundlight/motdet_patch
Browse files Browse the repository at this point in the history
Flag Motion Detection if New Image has Different Dimensions
  • Loading branch information
blaise-muhirwa authored Jul 20, 2023
2 parents 625f143 + 7571304 commit fe70ad1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "framegrab"
version = "0.2"
version = "0.2.1"
description = "Easily grab frames from cameras or streams"
authors = ["Groundlight <[email protected]>"]
license = "MIT"
Expand Down
4 changes: 4 additions & 0 deletions src/framegrab/motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def motion_detected(self, new_img: np.ndarray) -> bool:
return True

new_img16 = new_img.astype(np.int16)

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

Expand Down

0 comments on commit fe70ad1

Please sign in to comment.