Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Motion Detection

Blog post: https://matthew-bird.com/blogs/Motion%20Detection.html

Motivation

Current systems for motion activated cameras cost quite a large sum, and thus I thought it would be an interesting project to see how cheap I can get a motion activated camera to be using an ESP32 microcontroller connected to a camera communicating to a central hub. Although I never got around to testing with an ESP32, the code still worked on videos I tested from online.

Method

Similar to my volleyball project here, I take the median of the past n frames to create an estimate of what the background should look like with no moving object in it. Then, I take the difference between the current image and the background, and if the proportion of pixels with a difference above a threshold is above a threshold, motion is detected and a video is saved.

To make the script capable of running in real time with multiple cameras, I also chose to resize the image to 192 x 108 for the median calculations, as that was originally accounting for 95% of the total processing time.

The script saves all the scenes of the input video where movement is detected as a series of videos in an output directory.

Images (taken from the Volleyball project)

Input

Median

Movement mask

Setup

  1. Upload .mp4 files to the In directory
  2. Run example.ipynb

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages