Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Dec 2001 23:52:30 -0600 (CST)
From:      John Utz <john@utzweb.net>
To:        Tim Pozar <pozar@lns.com>
Cc:        <multimedia@FreeBSD.ORG>
Subject:   Re: Motion detection software?
Message-ID:  <Pine.LNX.4.33.0112092328340.5479-100000@jupiter.linuxengine.net>
In-Reply-To: <20011207224143.C12766@lns.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 7 Dec 2001, Tim Pozar wrote:

> I am looking for motion detection software.  I want to only capture
> video frames that have changes such as someone walking into the
> frame.  It would be nice if it talked to the bktr device but if it
> is something I could just pass jpg, pbm, etc. frames to and get a
> result back I would be happy.
>
> Anything out there?

well....not that i am aware of, but here's how to write one...

1.do a 2d FFT on each frame. that will provide you with a 2d array of
  values, 1 for each frame.
2. then use a hash function of some sort to map the array values to a
   single unique number.

3. let this run continuously, note that it only needs to retain the value
for the current frame ( call it n ) and the second preceding frame (n-2).
recall that you want n-2 and not n-1 because the frames are interlaced -so
the picture gets 'half redrawn' from top to bottom each frame.

3. if n != n-2, than somethin' moved!

caveat: it might be better to skip the fft if you can figure out a
hash value for the entire frame.

caveat++: a hamming distance kinda' thing might be even better than a hash
because the value difference in a hash is not proportional with the
difference in the original data. that would have the benefit of providing
some discrimination, if the distance is above a certain value, than
something moved, if it's below that value, than it might be just a fan
spinning, or the difference between lights on and off, or a butterfly
going past....etc

note that the lights on, off situation would probably require
reintroduction of the fft so that you could get a handle on the energy
profile difference between lites on or off.....

all of these algorithms are either already coded in a library somewhere or
have the algorithm written out in mind numbing detail in numerous places
on the web, usually lecture notes from a CS class for the hash stuff, EE
class for the FFT, and either or both for the hamming stuff.


sounds like a fun project for those with copious free time... :-)

> Thanks...
> Tim
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-multimedia" in the body of the message
>

-- 

John L. Utz III
john@utzweb.net

Idiocy is the Impulse Function in the Convolution of Life


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-multimedia" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.33.0112092328340.5479-100000>