<<back

Napier Webcam Technical Overview

The hardware consists of a 3.0 megapixel day/night IP surveillance camera and a local dedicated laptop to manage the image transfer to this website over an ADSL connection.

Megapixel IP Camera
The webcam utilizes a 2007 model Arecont Vision AV3130 Megapixel IP camera. This high-tech surveillance camera has two separate imaging sensors - a 1/2" 3.1 MegaPixel color (daytime) and a 1/2" 1.3 MegaPixel monochrome (nighttime, down to 0.015 lux.) It can output single JPEG files, or streaming MPEG "video" at up to 20 frames per second on the local area network. The 16mm lens on the daytime sensor provides a 22-degree view of the city through a polarizing filter. There is no lens currently installed on the nighttime sensor.

Toshiba Portege 4000
The Pentium-III laptop with 128 MB RAM runs Windows 2000 and is tasked with requesting, processing, and uploading the image file to the website host on a time schedule. Although the host computer is not absolutely essential, it substantially improves the security of the camera and removes the need for an open port on the local router and a DDNS client to handle the dynamic internet IP.

Hardware Details

Megapixel IP Camera
This is a sophisticated product as far surveillance cameras go - the manufacturer claims it can execute six billion instructions per second - computing JPEG or MPEG compression in real time. In its present state of firmware development however, all single JPEG images produced are technically corrupt which makes rigorous methods of retrieval fail (such as PHP.) In addition, after the camera is idle for a while the data buffer often accumulates spurious data which is added to the next downloaded image - visually-corrupting it as well. These issues are not a problem in the normal use of this camera in "video" mode with specialized surveillance programs, but in single-image use requires some extra care.

All images can be requested at either half or full resolution. "Full" resolution images at 100% are QXGA (2048 x 1536) daytime and SXGA (1280 x 1024) nighttime, while "half" resolution images at 100% are XGA (1024 x 768) day and 640 x 512 at night.  Specifying "full" or "half" does not distinguish between day and night, complicating things somewhat when you expect a certain image size. Currently I'm only using the color side of the camera for this reason.

The JPEG quality is adjustable between 1 and 20, but is best left at 20 to minimize artifacts. Almost any rectangular portion of the image sensor(s) can be downloaded by specifying on the command line the coordinates in pixels or percent, in either full or half resolution. I say "almost" because some values don't work and all must be on 8 pixel boundaries.  Default settings can be locked-in for images requested without any custom values, which is the mode I use, however for some reason the full height of 1536 does not "stick"- only 1456 can be reached.

Unlike a standard CCTV camera it does not have a connection for an auto iris lens. Arecont indicates that the CMOS sensor can tolerate a much wider range of light than a CCD.

The camera is powered either by standard Power-over-Ethernet (PoE) or directly with 12 VDC at 500 mA. It can use a static or dynamic IP, and be password-protected at both viewer and admin levels. A URL of the form http://<username>:<password>@<ip>:<port>/ is used to address the camera when passwords are set.

Webcamimage borrowed from Arecont Vision

Lenses

The color-side of the camera is fitted with a Japanese-made high-quality 16mm 1/2" C-mount machine vision lens equipped with a manual iris. This gives approximately a 22-degree horizontal field of view, ideal for the desired scene. This is not specifically a "megapixel" lens but produces a reasonably-sharp image when stopped-down to f/5.6. Anything less produces poor off-center focus. I have also recently installed a polarizing filter in the housing. The addition of the large filter has made it now impossible to use the monchrome side of the camera.

Outdoor Housing

Although the webcam is mounted out of direct weather and sunlight, it needs protection so an outdoor enclosure was fabricated from 90mm PVC drain pipe and matching end caps. The "weather" window is the circular polarizer filter glued in place with epoxy.

The rear cap is glued permanently in place while the front cap is sealed with Castrol Rubber Grease and retained with (2) sheet metal screws. The purpose of making the front cap removable rather than the rear was to facilitate ease of precise in-situ focusing. The assembly was painted with gray primer to avoid UV damage to the PVC. The camera is retained internally to the housing by a single 1/4-20 screw and custom spacer from the top.

The cable is stranded CAT-5E and is sealed to the enclosure with epoxy. There is a small cut through the outer insulation at about 1 meter from the camera to allow the cable's loosely-fitted outer insulation to facilitate air flow to-and-from the camera body as required for thermal expansion of interior air. The cut in the cable is then located inside the residence out of the weather to ensure only reasonably-dry air enters the camera housing.

Rather than run another cable for power, the two conductor pairs that are not required for 100baseT (of the four present in CAT-5E) have been diverted away from the RJ45 connectors at each end and used to supply 12 VDC to the camera. Lastly, the pan-and-tilt head is from a small Targus tripod and the mounting bracket is fabricated from 1/8" x 3/4" 5052 aluminum bar. In addition to the polarizing filter which is not shown in the photos, I've installed a short hood over the front to reduce glare. The photos show the earliest revision which used both the day and night sides.

Arecont


Software Details

Toshiba Portege 4000

Windows Scheduler triggers a short CMD batch script transfer_image_bat.bat to run at 10 minute intervals, which does the following on each cycle:

1. Draws two images off the camera at the pre-programmed default size of 2048 x 1296 pixels (see note 8.) The first image is written-over in case it happens to be corrupt. The freeware http utility used is wget.exe.

2. Calls batch script sizecheck.bat to check the file size to ensure it is between 100 KB and 450 KB. In the event that the file size is outside these limits (meaning the image is most likely blank, corrupt, or excessively noisy) the script is terminated with an exit which closes both batch scripts. Normal images are in the ballpark of 350 and in this case returns control back to transfer_image_bat. Images taken in dark or winter conditions tend to be larger in size due to a high level of noise in the image. I've seen up to 566 KB off the camera and so setting a limit such as 450 KB terminates image updates when they are no longer useful.

3. A timestamp text file is generated of the form: Mon 24/08/2009 19:00:03.16

4. Using the freeware program jpegsize the image is reproduced at exactly 50% of the original dimensions. It is now 1024 x 648 pixels and typically 130 KB in size. Jpegsize has one other essential function - unlike the source file, the newly-generated file will comply with the JPEG specification which is needed for PHP to function correctly later on. This would work even if the size was retained at 100%. Note, jpegsize operates on all jpeg image files found in the current folder - including those it generates.

5. Another image is drawn off the camera using the X-Y parameters x0=0%, x1=100%, y0=53%, y1=95%. This produces another 1024 x 648 pixel (140 KB) image of the lower-left corner of the FOV - a view of "The Dome."

6. The (reduced-size) main image, timestamp file, and dome image are uploaded to this website's host using Window's command line FTP client and a custom script.

7. The main and dome images are then deleted so that jpegsize does not inadvertently process them on the next cycle. The original source image can be left as-is, as it will be written-over at the start of the next cycle - as will the timestamp file.

Once on the website the main image is processed further when (and each time) the home page is accessed. A PHP script from Mike Challis at Long Beach, WA Weather is used to include the text on the face of the image. I modified the script very slightly to source the time/date stamp from the first 20 bytes of the external datestamp file so that it could be an actual timestamp rather than just static text. This truncates the sub-second time data.

The main webcam image at this point is typically 230 KB - the addition of text with 95% JPEG quality nearly doubles the original size.

Clearly if any part of the process fails the last good image will still be present on the website.

The "dome" image is presented via a javascript "swap" action on double-click, returning on single-click. That image is typically 130 KB.

Further Notes

1. The camera has poor color rendition compared to a typical consumer digital camera. It took a lot of experimentation to get the color even close to being realistic. The white balance has one automatic and three fixed settings plus the blue and red levels are separately adjustable.

2. Using a true multi-megapixel lens would improve the sharpness. However, I've not been able to locate a suitable lens with a 16mm focal length. With the final image being only 0.7 MP the added value may be minimal.

3. Since the scene has a high level of long-infrared ("heat") during the summer and the lens is not IR-compensated, the focus is slightly blurry on vegetation and white objects. Modern high-quality CCTV lenses for outdoor use sometimes are offered with IR compensation which corrects this effect.

4. The camera can output MJPEG video to Opera and Mozilla web browsers but this is not possible over the internet without opening a router port - compromising the security of the camera and LAN. The camera can be password-protected on both admin and viewer levels but it's much harder to make image quality adjustments.

5. Having a local host PC (remotely accessed) vastly simplifies the ease of adjusting and optimizing the camera's performance as an outdoor webcam.

6. The sharpness setting is best left at 1, the second lowest (0 of 4) setting as it only damages the image.

7. For some reason in this application Windows 2000 consumes more memory resources the longer it runs so a reboot every three days is essential. The scheduler is used for this along with a reboot utility.

8. The camera's default image size is currently 2048 x 1296 resulting from these settings: imgtop=64, imgheight=1360, imgleft=0, imgwidth=2048, imgres=full.

2010 © Paul Axford

<<back