Skip to content

Latest commit

 

History

History
20 lines (12 loc) · 1.34 KB

README.md

File metadata and controls

20 lines (12 loc) · 1.34 KB

Detect motion using web camera and display notification

How to use

Run server.py. You can add "--help" parameter to see possible options (HTTP port number, threshold (sensitivity) and SSL if needed).

server.py -p 8000 -s 100000

Open html page in a browser specifying the host where the server runs and the port number:

http://localhost:8000/index.html

Notification should be shown (message box on Windows or console output on other platforms) when camera captures any motion.

How it works

Html page + JavaScript captures video frames from the camera. Each video frame is compared against the previous one and difference is calculated as a number (greater difference makes greater number). Those numbers are sent (using WebSocket connection) to the server which serves the page itself. The server analyzes received numbers and if some number is greater than specified threshold then a notification is displayed.

Server is implemented in python using standard python libraries. Supported platforms - any with modern browser (for client side) and any with python installed (for server side). Tested on Windows/OSX/linux/android and python 2.7.

Regards

Thanks to Benjamin Horn for this article and code.