jump to navigation

Creating a home security camera system, part 3 February 10, 2006

Posted by cnchapman in Technology.

Getting the picture.  In this part, I talk about how to get the images from the Toshiba camera so they can be used by other programs for archiving and motion detection.  This was trickier than I anticipated.

As mentioned earlier, I selected the Toshiba IK-WB11A camera for the visual part of the network.  The camera worked well right out of the box.  There are various options that can be set on it and are self-explanatory.

My first requirement for this system was to store pictures continually, regardless of whether motion was detected in the images.  That way, regardless of whether the motion detection algorithm works or failes, I will always have a real time backup (backed up in two places).  To do that, I needed to access the images in real time.

This posed a problem: how to access the Toshiba’s photos without using a web browser or their software.  The documentation does not describe how to capture the current image as a simple JPG file.  Eventually I found the answer from another user online: access the current image as :http://your.ip.address/__live.jpg?&&&

With that working, I wrote a Windows program using Delphi that would retrieve the images every second (or at any specified interval) and save them to the network locations.  This uses the Delphi Indy socket components for the http download, http://www.indyproject.org/.  I won’t post my code, as there are good examples online already, such as http://www.swissdelphicenter.ch/torry/showcode.php?id=2391.

Unfortunately, if you want to archive the images indefinitely, you will need to invest in a program to read the image files and save them.  There are a lot of ways to solve that, ranging from writing your own (as I did) to buying one online.  The Toshiba camera offers the onboard ability to detect motion and send email.  However, I did not want to bog it down sending mail and the like — I wanted a fast, responsive camera, not a camera trying to be a server.

Now the second problem arose: I wanted to do motion detection on the live images.  If there was motion detected from one frame to the next, I wanted the frame with motion to be stored on an external machine (not in my house) in real time and also backed up to various local locations.  I set up “motion” on my linux server to monitor the images.  It likes to look at a live stream, not at sequentially saved files with different names.  So I pointed it to the camera URL as above — but it didn’t work.  It seemed that it could not authenticate successfully against the camera, and thus could not get the image.

I solved this with a two-step approach.  First, I modified my file-saving program to save the latest image for a camera to a specific, unchanging file name (in addition to the incrementing file names for the archived images).  Second, I installed the Abyss web server http://www.aprelium.com/ (free for personal use) and configured it to serve up the current camera image files on my network.  Now Motion could look at the file for a given camera and run motion detection perfectly. 

Here’s a screenshot from my application, showing how it archives the images to multiple places and to the web server location.  (Note that the picture quality is low because the hard drive box is very close to the lens.)


This also solved one of my other requirements: to be able to monitor cameras.   I can simply point a web browser to the appropriate file on the web site.  Of course that only runs locally, since I don’t want to serve up images on the Internet.  (That would be easy to configure with Abyss, just not necessary for me since any with motion detected are stored externally anyway).