

How to Make a Webcam Intruder Alarm with Mathematica - nswanberg
http://blog.wolfram.com/2010/11/10/how-to-make-a-webcam-intruder-alarm-with-mathematica/

======
nswanberg
The real news here is the CreateScheduledTask[] and related functions.

"...I could use an infinite loop, but that would lock my Mathematica
completely. I might want to run overnight computations at the same time, or
have other events happen periodically, so instead I program a scheduled
interrupt _(another new capability)_ that will suspend any running Mathematica
program, run this command, and then return to the program."

Mathematica hasn't previously had a way to manage a long-running process by
itself. For a long time this would have been accomplished by calling
Mathematica kernel from another program using a linking library. Not very
difficult but it still would have been another step. Now it's built in. Cool.

------
oostevo
This is sort of off-topic because it's not using Mathematica, but this[1] is
another really neat intruder detection system that I've found that's
surprisingly accurate.

It's based on a technology[2] created by the guy who made Palm.

And here's a guy trying to fool it and mostly failing.[3]

[1] <http://vitamindinc.com/>

[2] [http://www.numenta.com/htm-
overview/education/HTM_CorticalLe...](http://www.numenta.com/htm-
overview/education/HTM_CorticalLearningAlgorithms.pdf)

[3] <http://www.youtube.com/watch?v=tXtaZSHs77A>

~~~
nswanberg
Not off-topic, as the submitter appears to have already brought up Vitamin D,
Numenta, and Jeff Hawkins (guy who invented Palm) earlier in this thread. ;)

Bonus points for the hilarious example video.

~~~
oostevo
Ah. Well that's embarrassing. I could have sworn that comment wasn't there
when I posted that ...

~~~
nswanberg
Not important, just a bit funny. It's refreshing to know that I'm not the only
one whose heard of this software. The HTM-based video software is interesting
but it seems like its still waiting for its killer app.

------
nl
Pfft.

Webcam intruder alarms don't need Mathematica. Here's a hacky Python one I
came up with (I don't know Python, but it only took a couple of hours):
<http://pastebin.com/zXexPwSi>

Basically it shrinks each image, turns it monochrome and then compares it with
the previous frame, with some allowance for noise. You do need to edit the
MONOCHROMATIC_MAX_VARIANCE for day vs night.

------
vinhboy
Last summer I bought a webcam with a built-in server. I was going to do
something like this, but never found the time. Thanks for the reference link.

~~~
nswanberg
Your webcam has a built-in server? Wow. Which is this?

I wasn't as interested in the security cam aspect as much as how much
Mathematica can do with relatively little code, but I'd like to point out a
couple of things about actually using this:

1) Not sure what kind of camera/server you have, but it would probably have to
run this not yet released version of the Mathematica kernel, which you would
have to buy. If that works, great.

2) If that doesn't work, there is another company called Vitamin D that has
released software that works in a similar way. <http://www.vitamindinc.com/> A
single-camera version is free.

(Fans of _On Intelligence_ author Jeff Hawkins might note that this technology
is directly based off of his theory of how the mind works. Cool stuff.)

~~~
heyrhett
We sell video cameras with built-in linux servers at <http://cam.ly> . They
are commonly known as IP cameras.

Without a service plan, they start at $150, and they run busybox.

Ours already do intruder/motion detection on the cameras.

