JS WebCam Motion Detection

By Jason Mayes. Subscribe for updates on official GitHub project page.

You will need to view this on a secure connection to access the webcam. Please ensure you are using this link: https://codepen.io/jasonmayes/pen/IrwHG/ and allow access to your webcam when it asks! Otherwise you will see the GIF of me testing it!

A simple, fast, and lightweight (just 531 bytes gzipped when minified using Google Closure compiler) motion revealing algorithm using the live webcam feed.

I was trying to devise a super sensitive motion revealing algorithm which was fairly robust against small changes in lighting etc which was capable of running in a fast manner on desktop and mobile devices.

The nice thing about the result is that all non moving pixels converge to a neutral grey colour. Any changes are darker / lighter than that neutral grey colour. Larger shifts leads to greater contrast.