WebCams here we come.

Community Forums/Showcase/WebCams here we come.

Wings(Posted 2005) [#1]
Iv been working on this wecbam gaming. and i manage to
come some what far. Many thanks to Panno :)




Link do a working demo compiled. its with source.
Warning the compiled version is slower.. !
http://server..tiberion.eu/2007/bounce_ball_webcam.zip

Last edited 2013


jfk EO-11110(Posted 2005) [#2]
Piano? You mean PANNO, right? hehe. Yes, it's great fun to play with the webcam DLL. unfortunately it dosn't work with all cameras (a color format thing). If you flip the image horizontally, it's goona feel like a mirror and allows eyetoy-like stuff. Not so far I made a painting demo. The user had to shoot his TV Remotecontrol against the camera (camera was on top of the monitor). The Blitz App then recognized the bright RC's IR LED dot and used to paint something at that screen coordinate. Like when you had a laser pointer that would actually paint something.

Then I had this Idea (unfortunately never implemented, don't steal!!! :P ) A device, glove or something, containing 3 LED Lights. They build a triangle. Now when the angle of the glove to the camera is zero (on all axis), then the distance between all LEDs is equal, and it's aligned to the camera horizon. Based on the size of the triangle in the Webcams Image we can compute the distance between the glove and the camera. Now when the distances between the LEDs are not equal, we are also capable of computing the angle of the glove in space! And of course the position. As long as it's inside the field of view of the camera.

Finally we got a 3D motiontracking spot for the price of 3 Light Emitting Diodes and a battery cell. 2 Dollars maybe. Of course, 3 diffrent colors should be used to make tracking easy, and it should be used in relative dark enviroments, so the LEDs can be detected easily.

Well, however.


Bot Builder(Posted 2005) [#3]
Uhm, sorry to burst your bubble jfk - but they've done it.

http://www.mts.net/~kbagnall/p5/p5%20dissassembly.html

Well, the p5 actually has 8 LEDs and the tower isn't a camera - it's four photodiodes. The LEDS each are on for a very small period of time when its position is found with the diodes. Then it takes all the LEDs it can see and figures out the best matching glove matrix.

Its also got 5 bend sensors on the fingers.

I got a b3d userlib for it working but i'm basically teh only blitzer that has one.

Anyway, cool camera stuff.


jfk EO-11110(Posted 2005) [#4]
Didn't know that gove is using LED's. I wanted to buy it some time ago, but they didn't seem to deliver to europe.
Well, there's a little price diffrence between the 3 LED solution I suggested and the glove.


Bot Builder(Posted 2005) [#5]
Yeah. Also a bit of quality difference - its only 8 LEDs - the LED price isn't the bottle neck. Actually, 8 LEDs isnt quite good enough. If you do say, a stop sign hand sign it can't figure out where it is.

I suppose yours might be more accorate if it's a camera. You have to think about LEDs being obstructed though.


Wings(Posted 2005) [#6]
yes PANNO is the right name.. i change it now. i becom wordblind :)

I cold not run that Paint program.. maby iam using wrong dll ? i dont know.. i have to pick up image from C: and then read colors on it.. i think i know why the compiled version runs slower.. maby the DLL works better :) and compiled code get less cpu time.

This kind of DLL u can make verry fun things..
Strangley i cold not readpixel from preview nor cold i copy it. i think blitz dont access the real front buffer in..

if i cold get hold on that preview image.. pixel datas :(


jfk EO-11110(Posted 2005) [#7]
you're using the wrong dll! PANNO made a version that was transporting the webcam image right into a blitz bank!

So you can use the bank to do something funny, or you may even use the Bank-as-image hack (see archives, decls), that bends a bank vector to the pixel data of an image, so you could draw the image right away (the dll frequently sends frames to the bank automaticly). Well there have been two version, one was sending images automaticly (this produced some snyc problems with my apps) and one version was waiting for a frame request by blitz and then sent the latest frame.

With my Camera (creative w3 something) they worked perfectly. Maybe I really should play with them again. I remember I even made a Webcam server based on tcp, but it didn't work for some reason on win98. Maybe it's time to revisit that one.


jfk EO-11110(Posted 2005) [#8]
I don't remmber what version is what, maybe one of them fits for your needs:
http://www.melog.ch/dl/panno_webcam_2005_newdll.zip
http://www.melog.ch/dl/panno_webcam_dll_30_11_04.zip
http://www.melog.ch/dl/panno_webcamdll_2003.rar
I think there have been more versions, but these are the ones I found quickly.


Damien Sturdy(Posted 2005) [#9]
Heh, this is sweet

I just made a motion detection thing... Now i need to add some servo's to my webcam! this thing can figure out when i point my arm out like im about to shot someone, and then highlight my hand, hehe, cool.. Screenshots as soon as i figure out how to get it to know when to take one :D


Wings(Posted 2005) [#10]
Oboy iam i using a outdated dll !
panno_webcam_2005_newdll.zip is accaly lastmodify 2002 !!

thats why i had trouble with it.
Thanks jfk EO-11110

ill be updateing this project with a correct dll as later tonight.


Damien Sturdy(Posted 2005) [#11]
I'm not even sure what version i'm using- It has 3 preload windows though.

I've had multiple successes with Motion Detection- even getting it to higlight a target over the centre of the motion (my chest if im moving around, my hand if i'm waving, or the middle of my finger if i'm wobbling it). another mode will detect the fastest moving parts.

One mode actually detects say, the centre of my body, and a few on my arms when i move them, along with the tips of my fingers, all at once.

A small bit of more maths and a bit of memory code would make it detect what is actually moving- like, it would know i've moved my hand- because it would find the nearest movement in the last frame and assume that the nearest to it in the current frame is the same object.

Was funny last night, getting it to look out for the dining room. On occasion, it would detect the cat because it yawned :D


Wings(Posted 2005) [#12]
iam gettin nuts..
seams that the dll causes blitz to stall then it sends over imgae data rgb or capture it..
so i still recives images at poor rate. its not so baad to have em in poor rate.. the bad thing is that the dll pauses blitz.. so blitz cant continue with AI and other things..


Damien Sturdy(Posted 2005) [#13]
I upped the speed by doing 1/4 pass each frame :)

Have you tried more versions of the DLL?


Panno(Posted 2005) [#14]
oh i see the dll is living ;)

anyone remember ??




ok folks after a long time with no support i will (if i have enough time) help the blitzers with problems.

write here .....


Damien Sturdy(Posted 2005) [#15]
He lives! YAY!

Can i ask of you to supply the latest DLL? I cant actually tell which one i'm using :D lol!


GitTech(Posted 2005) [#16]

anyone remember ??



I remember :-)


Anatoly(Posted 2005) [#17]
I don't(Well, I've joined fairly recently)! Where can I get this stuff? Looks pretty cool if you ask me!


jfk EO-11110(Posted 2005) [#18]
Hi Panno! Maybe you can tell us the history and details of the released versions. I remember one was sending the frames to a bank using a parallel process, so blitz wasn't paused (although the system may slow down for moments). Then there was the version that I asked you for: Explicitly request frames in Blitz. Then there was also a version with a 640*480 Pixel canvas, pretty useful too although even lower, of course.

And if you still got them online, that would be fantastic!


Panno(Posted 2005) [#19]
hi @all

i remember me not at all versions . in the moment i search for
my source's in my backup cd tower . (30-50 CD's)
i hope i find all i need .

it is possible to make a new dll with

a. sends capture screen direct to a bank ,permanently with
a specific ( user) framerate

b. sends the captured frame only if blitz is called the function ( giveme ;) ) but its slow because it init a driver ..

it is possible to select the source (webcam,tv-card,other's)
but unfortunately i have to tv-card or other input sources

i most cases is xp the OS with better support from me , because i have no w98 computer here .

if u need 640*480 the speed is much more slower , the dll must 640*480*4 bytes calculated ...

i prefer 320*240 .

if u have any ideas i will help

@ Wings hehe Piano is also a cool name ;)

mfg Panno


jfk EO-11110(Posted 2005) [#20]
It's amazing when you search for the word "panno" on your harddrive. Well this time I was searching for it not only on my web terminal, but on my workstation.

So I have refound the webcam_640dll.zip
This version sends 640*480 frames to a bank continously (parallel to the blitz processes). It also allows to pause and continue frametransfer.

It seems the other versions are already listed here.
the one with the date 30.11. is the version that sends 320*240 pixel frames continously, parallely to the bank.

Right now I don't see the version that forces explicit requests for frames. For me it was useful because it allowed me to grab the latest frame in an accurate way. (the unsynced autofeed results in grabs that contain data of multiple frames, eg. the first part of the previous frame and the 2nd half of the next frame).

Also the 640 Pixel version was very useful for my 3D scanner experiments - 320 Pixel was way too rough to detect a fine structure on the surface of an object.

BTW: see the original Thread here:
http://www.blitzbasic.com/Community/posts.php?topic=27007
it also contains the source of my mentioned TV Remotecontrol Drawing proggie and a screenshot. That was funny.


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

One function that would be really useful with the parallel process would be a "New frame ready" check.

That way i would be able to only run update code when a new frame has arrived :)


Panno(Posted 2005) [#22]
@cygnus this is a cool idea - iam such a noob
i have this variable in the dll but not for blitz ,but it will come


Damien Sturdy(Posted 2005) [#23]
Cheers.

IM just writing a noise removal routine that removes noise using the difference between the last frame and the current frame.

Not good for visuals, so i store them elsewhere, but great for motion detection :)


Wings(Posted 2005) [#24]
I like the DLL much :)

the dll that list here cost blitz its powers.

It seems the other versions are already listed here.
the one with the date 30.11. is the version that sends 320*240 pixel frames continously, parallely to the bank.

then i leav it runnung even not even toch the out_bank data. blitz3d will start lagg horribly. i think blitz call that dll a little to much :) like frame rate is betwene 8 -200 ms.

as soon as i stop capturing blitz runs normal..

the strangest thing is that i at same time look in the cpu usage and its only 16%..


jfk EO-11110(Posted 2005) [#25]
Maybe a bus conflict. You know, when some punks want your seat and so on.

I think I solved this at least partially, by using the stop function, so I started and stopped the dll explicitely for every frame. Not sure if this works with all versions.


Damien Sturdy(Posted 2005) [#26]

I think I solved this at least partially, by using the stop function, so I started and stopped the dll explicitely for every frame. Not sure if this works with all versions.




I did that, it didnt work for me though- mi pretty sure ONE version did work.


Wings(Posted 2005) [#27]
I have figured out problem.
as soon as i run the dll doing nothing else..
my computer starts to slow down.. i cant detect what happends.. even mspaint Blit goes slow. it is like its trying to access disk some how ? Like loading a big file from your lan server and try playing a game at same time. =verry baad lagg.


Picklesworth(Posted 2005) [#28]
Heh, I've been wanting to do this motion sensing stuff for ages now... just never gotten around to it.
I'm curious if I was on the right track... Are you removing the background by detecting which parts of the video feed are moving and which aren't?


Wings(Posted 2005) [#29]
i just detect light :)
and i check if color has changed under the ball.


Panno(Posted 2005) [#30]
goto motion detection


Damien Sturdy(Posted 2005) [#31]
Thats cool, I can get similar stuff working too :)


wobby(Posted 2005) [#32]
Hi Guys,

JFK,
I noticed you said you found a version of the webcam_640dll.zip somewhere on your computer?

Would it be possible for me to get it off you ?
Or would you to be able to upload it into the code archives please ?

I really like the panno dll, but the 320x280 one i'm messin with is just not doing the job at all.

I absolutely cant find a 620x480 version anywhere.


cheers


jfk EO-11110(Posted 2005) [#33]
wobby:
http://www.melog.ch/dl/panno_webcam_640dll.zip


wobby(Posted 2005) [#34]
JFK,

Thanks buddy, that's most definity made my day.
Works perfectly. Thankyou.

cheers


Panno(Posted 2005) [#35]
np.


jfk EO-11110(Posted 2005) [#36]
yeah, thank Panno. I am only a tool in the hands of the lord.


Panno(Posted 2005) [#37]
ok a new dll is out (DEMO)

http://www.plasma.art-fx.org/METHYL.zip


Please test all features (screensize /format )

please give feedback !


Panno(Posted 2005) [#38]
ok new b3d demo

exe ,dll,bb-source

www.plasma.art-fx.org/B3d-METHYL.zip


EOF(Posted 2005) [#39]
Works fine on my PCLine webcam using 320x240 (RGB 24Bit and 1420). Anything greater causes a MAV. Anything less mucks up the image.


Panno(Posted 2005) [#40]
@jim

you must change the imagesize in the blitzsource if you
try other imagesizes


Wings(Posted 2005) [#41]
here is an example of another camera application.. educational game.
http://www.shareup.com/viewscr.php?id=19664



the point is that it is 900% faster than your dll ?
and seamt to be written in c++ or visual basic.

cant your speed upp the dll ?


Panno(Posted 2005) [#42]
the b3d -methyl dll needs 12 ms to get a frame
the b3d -methyl2.dll ( not outyet ) needs here 3-6 ms to get a frame

is this to slow ?? hmm

please give some tests from your computer

m=millisecs()
call getclip()
test= millisecs()-m
debuglog test


Wings(Posted 2005) [#43]
well 12 ms is a frame lost. in best case i got frame in 12 ms. but some times it takes dll 112 ms to get frame.

also MSN is slow on my pc.. it too implemented webcam poor.

usaly my program waits for the dll to finish.. so it get verry laggy.. and if i compile program it even runns slower.

call getclip() ? sounds interesting :)


the thing was that i thougt it was my webcam that was slow. but it seams that that game above runns it like lightning. (have u tested it ?)


Panno(Posted 2005) [#44]
yap testet the game

ive goto 14,xx frames per sec video
and 0 msec for prozessing <- omg


Panno(Posted 2005) [#45]
"realtime "image distortion 8 fps no fear !!!




Maxus(Posted 2005) [#46]
The interesting thing, but it is based on technology VFW.

And it very slowly, here if would alter on DirectShow, would be faster.


Panno(Posted 2005) [#47]
dont testet with directshow but maybe later


Maxus(Posted 2005) [#48]
What???


Panno(Posted 2005) [#49]
i mean i will make som directshow tests later

@ maxus how many fps ?


Panno(Posted 2005) [#50]
ok
this is my last dll , no more avicap !
its for b3d

if you find it usefull give me credits and if possible a link to your project .


www.plasma.art-fx.org/lastmethyl.rar


i dunno if i will make a new dll with directshow .

have fun


jfk EO-11110(Posted 2005) [#51]
Panno, thanks a lot for sharing your work here!

I tried to send you a mail, your web.de address seems to be gone. please send me a new contact address, eg to hanshuber008 ät yahoo.com

BTW. In the following thread your help is needed urgently:
http://www.blitzbasic.com/Community/posts.php?topic=54477
Thank you for your time!


Wings(Posted 2005) [#52]
i also beleve DS is much faster.. (hopefullty not delays blitz.)
i whold write one if i know DS :)


Maxus(Posted 2005) [#53]
FPS 5 - 10.

If to be necessary the help in DirectShow
Be knocked in ICQ 331454066.


Panno(Posted 2006) [#54]
anyone have lastmethyl.rar ???

its down from my server and i have no backup

iam a backup noob


jfk EO-11110(Posted 2006) [#55]
yes, wait a minute... ok:
www.melog.ch/dl/panno_webcam_dec2005_lastmethyl.rar


Panno(Posted 2006) [#56]
thx