Motion Detection.

Community Forums/Showcase/Motion Detection.

Damien Sturdy(Posted 2005) [#1]
Howdy!

Webcams sure are back in, arent they?

I've been playing with some maths n stuff recently and created this:





Download here:

http://danjeruz.servegame.com/Release.zip

Its quite sensitive- to the point that i can stand at the other side of the room, and blink- and it will detect me blinking, and highlight my eye :)


Ross C(Posted 2005) [#2]
Download speed is painfully slow :D But, looks cool!


Ross C(Posted 2005) [#3]
:o( It doesn't work for me. Maybe it because i'm using my PS2 eye toy as a webcam :o)


Eric(Posted 2005) [#4]
Keep getting a MAV. What Resolution did you set it up for? Frame rate.. and things like that.

Got it to sort of work at 640 x 480 but the image was very distorted.


Damien Sturdy(Posted 2005) [#5]
Image size 320x240. The demo code i modified did not work at all, i managed to get it to work at 320x240 only, 24 bit RGB info.

I should mention this is also using Panno's DLL- in fact, as you can tell by the titlebar, Its a modified version of some of his code.

As such, it never did work for everyone.


Panno(Posted 2005) [#6]
@cygnus

what is the name of your Camera ??
all pics are better as mine !

i use a logitech quickcam and it is verry noisy !

ah its the only for norc dll !!!! jfk is a bad guy ;)



@ross c i need your xp eye toy driver !!!!


jfk EO-11110(Posted 2005) [#7]
wot? it wasn't me. :-°

Sorry, lost control about what is what.


EOF(Posted 2005) [#8]
Works very well on my cheapo PCLine webcam (PCLW310).
Are you going to do any fun games with this?
"window cleaning", and "catch the ball" for instance?


Panno(Posted 2005) [#9]
i will glad if somebody post a blitz captured picture here
(as cygnus) .

if all pictures better as my pictures i need a better webcam


Damien Sturdy(Posted 2005) [#10]
Hi Panno.


My camera is a SpaceCam120.. pretty naff if you ask me :)

There has been aLOT of work put into that code to detect and remove the noise, otherwise it loks like an untuned TV set :)

Well, it can detect actual motion quite well- not fantastic, but quite well, so i might be able to do a punch-breakout or something :) using toka maybe?

Its quite slow though- not sure if it'd be really useful for anything :)


Noise removal:


I do it by comparing the last frame with the current one, and checking for a difference of *greater than X*

if it is different, then update the image with new info and add a MOTION flag to the pixel.

This still leaves quite a bit of noise in the motion flags, so you then skim through and check the size of each motion pixel- if it is surrounded by other motion pixels then its usually not noise- if it isnt, then it would be and should be reset so its NOT a motion pixel.

using the above method and only updating part of the images that are detected as changed, means 1) maybe i can encode a new video format and 2) i get a clean looking screen despite the noise from the webcam.


Panno(Posted 2005) [#11]



its "real" realtime !


EOF(Posted 2005) [#12]
Its quite slow though- not sure if it'd be really useful for anything
What about if you check say, every 4 pixels rather than each one?

Here's a grab from my PCLine webcam. It's it bit dark though:



Damien Sturdy(Posted 2005) [#13]

What about if you check say, every 4 pixels rather than each one?



Already doing that ;) :D it was even SLOWER before.

[edit]

Thats a great screenie too. I tested it with pens and it can pinpoint the centre of the pen quite well.

Stand a while away from the camera, blink an eye, blink the other eye, then stick your tongue out. It'll spot em all. (on mine anyway)

I might as well release source on this when im done playing :)


Panno(Posted 2005) [#14]
in the moment i have many better idea's for a new dll


my new dll is on the way (make better pictures) and is a little faster.

also a new scaleroutine for 640*480 is in.
if i have solved the bmp from clipboard problem the dll has no
problems with other formats as rgb 24.

only yvu9 will not work here .

i hope the eye toy cam will then work ;)




@cygnus
if you will i implement the source in the dll .
mfg panno


jfk EO-11110(Posted 2005) [#15]
Panno - sounds great!

Cygnus - are you using readpixelfast and writepixelfast? It may also be a good idea to read the pixels from a bank and write it to an image, so there won't be 2-way bus-transfer-related speed hits. Also make sure to use the fastest graphics buffer access. I don't remember right now, but some buffers are faster (image vs backbuffer, eventually texturebuffer using flag 256).


Damien Sturdy(Posted 2005) [#16]
Its all done with banks and arrays. (the bank Panno used, plus my screen arrays). Writepixel only occurs when its actually been drawn. No readpixel stuff is actually required.


Damien Sturdy(Posted 2005) [#17]
Panno:

The source is a mess,

perhaps we could talk online and i could explain what i've done, so that you could write it more efficiently into the DLL's source code? I expect it would be many times faster to do that!


Kalisme(Posted 2005) [#18]
Cygnus: I hope u do release the source code... I can't think of anything I'd use it for off the top of my head... but it would be fun to play with :D


Damien Sturdy(Posted 2005) [#19]
I will release the source, although because it's just me playing around, it's incredibly messy.

Would be better for you to understand how i did it, then make it more efficient ;)


Panno(Posted 2005) [#20]
ok cygnus i work also on my own routine here !


Damien Sturdy(Posted 2005) [#21]
Hi Panno.

I will also re-write my routine when a more stable dll is released. I think my method works well. Its just not clean yet.

Do you have an Estimate Time of Arrival?


Panno(Posted 2005) [#22]
my bmp from clipboardproblem is not solved yet

this is a must to device indenpendend images


Damien Sturdy(Posted 2005) [#23]
Okay. Keep us informed :D


jfk EO-11110(Posted 2005) [#24]
BTW did anyone try to make a webcam server so far?


Panno(Posted 2005) [#25]
iam not jfk .
but i have will make a observation camera for some friends ,
if motion detection thrue then sendimage to a server
with date,time.
now you can see who have stolen your lighter, or somewhat

no iam not paranoid ! its a must in some areas....


Damien Sturdy(Posted 2005) [#26]
Lol!

Panno, With my motion detection system (or a better written one- Contact me via email for code, routines ETC) you could make it just send the parts of the image that moved over :)

I'm still playing with it ATM, but when i stop, i'll pop it up here.


Regular K(Posted 2005) [#27]
I wish I had a webcam right now, this looks like fun!


jfk EO-11110(Posted 2005) [#28]
I have an Infrared Motion Detection Device, so when a burgler is in my appartment, the device will call my mobile cell. In the same time the webcams motion detection will upload images to a webserver. Now I need an app that will convert the image to a WAP compatible bitmap since my mobile doesn't support jpg. Hu Paranoia, what's that?

And I would also like to make a real streaming webcam server, with something like 5 FPS or more.


Panno(Posted 2005) [#29]
ah now i can load the bitmap from clipboard !
msdn sux

gn8

www.plasma.art-fx.org/images/wah.png

ok supports now all resolutions and all format here .

only yvu9 will not work !!!


Damien Sturdy(Posted 2005) [#30]
jfk! Why would you want to watch your house get burgled!? :P

Panno,


Excelent! Although, it looks like you havent moved from your computer in days.

I think i'll donate you a Webcam!


Panno(Posted 2005) [#31]
@cygnus

the pic is captured after a long night fighting with winapi

i cant computing all days because i have a hard full time job also.



@jfk look here

http://www.aspheute.com/artikel/20000613.htm


Damien Sturdy(Posted 2005) [#32]
Panno, when this is released, I think I'll rewrite my routines cleanly for you all to see. My code is a right state now!


Panno(Posted 2005) [#33]
http://www.plasma.art-fx.org/METHYL.zip

bah found a bug !
change row 44 to

ok = CallDLL("METHYL","INIT")