From owner-freebsd-multimedia Sun Dec 9 21:50:25 2001 Delivered-To: freebsd-multimedia@freebsd.org Received: from jupiter.linuxengine.net (jupiter.linuxengine.net [209.61.188.254]) by hub.freebsd.org (Postfix) with ESMTP id 88D0737B405 for ; Sun, 9 Dec 2001 21:50:22 -0800 (PST) Received: from jupiterweb.commercevault.com (jupiterweb.commercevault.com [209.61.179.16] (may be forged)) by jupiter.linuxengine.net (8.11.6/8.11.0) with ESMTP id fBA5qUO06603; Sun, 9 Dec 2001 23:52:30 -0600 Date: Sun, 9 Dec 2001 23:52:30 -0600 (CST) From: John Utz X-X-Sender: To: Tim Pozar Cc: Subject: Re: Motion detection software? In-Reply-To: <20011207224143.C12766@lns.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-multimedia@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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