OBSCURA LUCIDA

A Homebrew Video Surveillance System

I have two apricot trees in my backyard which occasionally yield a crop of truly amazing fruit. If you've never tasted a tree-ripened apricot, then you have no idea what you're missing. Those crunchy, tart things at the supermarket have nothing in common with the real fruit. The fact that my trees only sporadically bear fruit makes them more delectable.

camera One summer, the trees were heavy with fruit. I anxiously waited for the perfect day to pick them. And then suddenly, between Monday and Wednesday, they all disappeared. Wha-wha-what the hell?!

I knew that people had been picking apricots on the other side of the fence--thanks to the the alley that runs behind the yard--but in order to strip the tree, a person would have to jump the fence and enter my yard. That got me hoppin' mad, and it was then that I hatched a plan: why don't I dust off off my crappy old PC, add a camera and some software, and presto: homebrew video surveillance. Then I could catch the apricot thief in action. And thus was ObscuraLucida conceived.

On paper, the whole thing looked straightforward:

  1. The apricot thief blithely strolls into the visual field of the well-positioned camera.
  2. The well-positioned camera slyly forwards damning video evidence to a crappy old PC.
  3. Motion detection software on the crappy old PC notes the activity and records damning video evidence on the local hard drive.
  4. The software also posts a few image frames to this website.

system schematic

Implementation

As any engineer knows, the devil lies in the details. Obscura Lucida was bedeviled with details. For example:

Camera Selection: The trees are outside, but computers, particularly antique desktop PCs, prefer to live inside. The shortest run from a power outlet inside my garage to the external observation point is about 20 ft. This ruled out USB cameras (those extender cables are expensive, and it's not clear they'd even work over that distance). So the system had to use a weatherproofed, analog camera and a video tuner card.

Crappy Old PC: because the PC would reside in my detached garage, it needed to have network access via wifi. Remember the good old days, when computers didn't all come with wifi? Similarly, the PC needed to run headless (without a monitor or keyboard), and yet still allow me to access the system if necessary. Linux would have been the obvious choice, but Linux didn't support my video tuner card so I went with Windows 2000 and cygwin. VNC provided network access to the Windows desktop.

Motion Detection Software: The Crappy Old PC couldn't accommodate a huge hard drive, thus the system had to record only the "important" video (and rotate out old videos), thus the system had to use motion detection to figure out when to record. I didn't want to write this software myself. I'm not lazy or nothing, but surely this is well-trod ground.

Here's the configuration I ended up with:

I slapped the whole thing together and tested it by monitoring KittyPerdido's food bowl, which attracted a steady stream of hungry and furry visitors. Surprisingly, the thing worked. I tinkered with ObscuraLucida off and on over several years, and eventually refined it to the point where I could plop down the PC anywhere near an electrical outlet, boot it up, position the camera, and get video recordings + web updates. To configure the motion detection sensitivity and mask, I remotely accessed ObscuraLucida via VNC.

The system proved to be more work than I expected. System complexity grew as I added more features. I have a bad memory and months would go by between modifications, so I drew myself a diagram to document the increasingly Rube-Goldbergish mess.

data flow diagram

current view

Results

I installed the camera on a vantage point, overlooking one of the apricot trees. Because the field of view included the tree and its shadow, the motion detection software was very susceptible to false positives and triggered whenever a breeze wiggled the branches. These false positives accounted for 99% of the captured video.

The system also worked as intended, capturing exciting videos of the garbage truck and my neighbors' cars.

Here's a little gallery of the images I captured with ObscuraLucida.

Cats

Here's KittyPerdido.

KittyPerdidoMoocher/1_kitty.jpg KittyPerdidoMoocher/2_kitty.jpg

Mr. Scruffy was a feral cat who boarded next door

KittyPerdidoMoocher/7_scruffy.jpg KittyPerdidoMoocher/8_scruffy.jpg

Here's KittyPerdido leaping off the fence onto the roof:

Squirrels

KittyPerdidoMoocher/3_squirrel.jpg KittyPerdidoMoocher/4_squirrel.jpg KittyPerdidoMoocher/5_squirrel.jpg

Possum

Ne'er-do-wells

One day, the system captured a bunch of neighborhood miscreants assaulting the poor tree.

I never did catch the apricot thief at work, though I now know who it is (more on this later).

Epilogue

In retrospect, I can identify two particular weaknesses of the system. First, the false positives triggered by moving branches and shadows hampered the system's effectiveness. I completely overlooked the importance of having a controlled, static environment in terms of lighting and background.

The far more serious problem was the camera, manufactured by Swann (http://www.swannsecurity.com): Swann Color Outdoor Day/Night Camera N3960. I bought this camera at Fry's for $79, and at the time it looked perfect: water-resistent housing, color output, a ring of infra-red LEDs for nighttime surveillance. Unfortunately, the camera was complete crap. During the day, it conveyed a grainy image, neither color nor BW. At night, the LEDs were insufficient to illuminate anything further than 10 feet away. But the worst part was the contrast: an automatic gain control, built into the camera, invariably locked onto the wrong setting. Under perfect lighting conditions, in broad daylight, the scene would suddenly go completely dark (which also triggered the motion detector), or white out completely. Once the camera had entered this state, it would not recover until the power had been cycled or the contrast changed drastically.

I eventually figured out that the original apricot thieves were racoons, which are adept at climbing trees, have voracious apetites, and can smell ripe apricots from a mile away.

I decommissioned ObscuraLucida in 2009, cannibalizing the PC to build an ubuntu-based development system for my latest project.

/SystemLog


CategoryNerd

ObscuraLucida (last edited 2014-04-04 17:00:58 by RobertYu)