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).