Cheap web-cam monitoring in the Cloud with raspberry pi, ASP.NET MVC and Marionette.js

I’ve recently seen a few articles about video streaming with raspberry pi using node.js streaming server and ffmpeg utility. It’s funny how easily you can create your own live video streaming with opensource tools and cheap mini-computer. But there are some problems with this approach. The highest resolution I was able to capture, encode and live stream was 160×120. It is too low to recognize people or plate numbers seen on the picture. There are also some network issues that make things harder like maximum throughput, security and it requires you to have public IP.

All this issues made me wander if wouldn’t be better to capture fewer frames (1 per second or even per few seconds) but with higher quality – maybe event in HD which is not a problem for today’s webcams. If you have a bunch of time-stamped HD images you will be able to identify people or event read a plate numbers of passing cars etc. To overcome network issues I’ve decided to give OpenStack Object Storage (hosted by oktawave) a try.

First thing I had to do was to plug a webcam to my raspberry pi board and get it connected to my access-point.

WP_20150822_005

Then I had to upload two utilities from linux repositories. The first one was fswebcam used for capturing webcam image and the other one was imagemagick used for comparing pictures in order to avoid uploading duplicated images (when nothing happens in front of the camera there is no need to use cloud storage you for which you pay).

Then I have written a simple python script (available at my github) which generally does the following:

  1. authenticate against open-stack object storage,
  2. create directory for new snapshot (/camera-name/year/month/day/hour/),
  3. take a snapshot and compare it with previous one,
  4. upload picture to storage if it is different enough from the previous one,
  5. go to step 2.

The result of running this script on my raspberry was visible on my administration panel provided by Oktawave.

list

Using administration was not the most convenient way to browse my captured photos so I decided to use ASP.NET MVC 5, bootstrap and Marionette.js to create a simple browser of my data. The whole solution is also available on my github.

The app is very straightforward and it looks as in the picture below.

capture

The whole project is available on github. This is just a PoC but it’s amazing how easily you can create something fun and useful with these days’ toys.

Advertisements

One Response to Cheap web-cam monitoring in the Cloud with raspberry pi, ASP.NET MVC and Marionette.js

  1. Pingback: dotnetomaniak.pl

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: