pouët.net

Go to bottom

Webcam capturing

category: general [glöplog]
Hello, I'm trying to install webcam capturing to my demosystem. I'm using opencv, and it works, but I'm having a lot of problems, the capture is being done at about 1/2 of the FPS set in the webcam controller, and I can't get more than 15 fps. But, if I use the own camera software, I can save to avi in 30 fps without problems. I've read all the docs, internet examples, and no matter what I do, always the same problem.

So, my question is... do you know any other way/lib to capture from webcam? Do DirectX do it? Do you have any little example of it? I'm using VC 6. I just need webcam to image buffer. Thanks so much...
added on the 2007-11-25 03:52:03 by texel texel
Use the directshow SDK or something like that.
I tried using an webcam before but I failed to do it in 4kb (I could initialize it but I couldn't get access to the image on screen.
added on the 2007-11-25 03:55:22 by xernobyl xernobyl
Probably because you're capturing non-interlaced data and the original software did interlaced.
added on the 2007-11-25 04:15:20 by imbusy imbusy
imbusy, thats a good idea. I've just seen that my webcam can't capture in more that 30pfs, so that might be the reason for my 15fps limit...
added on the 2007-11-25 04:23:15 by texel texel
Now I'm downloading directx sdk to try directshow...
added on the 2007-11-25 04:23:40 by texel texel
Texel: check DSVideoLib: http://sourceforge.net/projects/dsvideolib

Check also the program and the source in http://www2.ati.com/misc/demos/ATI-9700-VideoShader-Demo-v1.2.exe

After DX8 the direct show sample related to smooth video capture (and the same direct show) now comes packed in the (not) handy and lightweight platform SDK.
added on the 2007-11-25 07:17:13 by bdk bdk
Thank so much for help. I think I will need to install a new version of VC and code my demosystem again... By now I think 15fps will be enough for tests...
added on the 2007-11-25 12:25:21 by texel texel
yah, fuck microsoft for removing VC6 compatibility in newer Platform SDKs.. The whole DirectShow thing is a complete mess.. they keep moving it around from SDK to SDK, and then after finally downloading and installing gigs of shit maybe you can find it... </rant>
added on the 2007-11-25 14:37:21 by bartman bartman
In theory DSVideoLib would be the best solution but unfortunately it wasn't for us for two reasons:
1.) it required admin rights during installation
2.) it frequently froze when capturing (this was ruling it out for us)

Our requirements were to allow full PAL resolution, full FPS capturing via an Osprey 100 capture card as well as getting the video stream of the cheap webcams. My solution was to take an existing interface called ARFrameGrabber (from ARToolKit) and reprogram it internally based on MSDN documentation.
added on the 2007-11-25 14:57:09 by noname noname
15fps ought to be enough for anyone
added on the 2007-11-25 15:28:55 by imbusy imbusy
platform sdk - not working in vc6
ati video shader demo - runs at 15 fps also
escapi - 15 fps

So, dsvideolib would be the solution... I've not been able to add it to my demosystem, but I think I could do it...

By other hand, I think other webcam would work better... do you know of good webcams by about 100€ or less?

And... have you done any interesant things with the camera capturing? I want to use it for interactive art installations. It is a great world to explore, were demosceners would fit very well...
added on the 2007-11-25 17:28:59 by texel texel
tried under linux? ;)
added on the 2007-11-25 18:08:33 by _-_-__ _-_-__
artoolkit for the win
added on the 2007-11-25 18:34:27 by psenough psenough
texel, are you completely sure that the signal isn't interlaced? because then you do get a 15fps stream with the two fields interleaved (just like DV, which has 25/29.997 fps video streams even though the actual signal is 50/60fps).
added on the 2007-11-25 18:48:38 by ryg ryg
ryg, I can't say with 100% security it is not interlaced, but, with the program to cam to avi capture the webcam provides, I get 30fps (also it looks the same with dsvideolib). I've look at individual frames and are not interlaced... but who knows if there is any deinterlacing algorithm in the middle...
added on the 2007-11-25 21:00:12 by texel texel
Ok, if you really insist in using vc6 you should search an old DirectX SDK, e.g. the original DirectX9 SDK from 2002/12. Not so easy to find nowadays, so have a look here.

Before you start coding you can check with the included dirctshow sample AmCap what formats/framerates you can get. Search for the pin and filter property page...

A good starting point for coding is the also included sample GrabberSample .
added on the 2007-11-25 22:32:23 by RufUsul RufUsul
Thanks so much rufsul, I've been searching it for hours...
added on the 2007-11-26 08:57:56 by texel texel
You're welcome!
added on the 2007-11-26 10:37:10 by RufUsul RufUsul
So now your demos are spying on me?
added on the 2007-11-26 13:17:20 by doomdoom doomdoom
I doubt you'd get interlacing at 30fps - that would be 15frames/sec which would look rubbish. One thing I do remember coming across with older USB cameras though is that they often support 30fps at low res (320x240 I guess) but only 15fps at 640x480. Worth checking if it's that.

About getting webcam input into a demo system - this is probably a little too radical a move, but in osx getting a video stream into a demo engine is trivial. I know because I've done it myself, and built an app that applies effects and overlays gfx etc. onto a live video stream. I did that without writing a single line of code too, just by clicking some buttons in xcode :)
added on the 2007-11-26 14:06:38 by psonice psonice
Might be what psonice said. Try using CIF resolution (352x288) or 320x240. Cheap/older webcams only support 25/30fps at those low resolutions.

If you want to capture to a DX9 texture you'll find a sample for that in the older DX SDKs. I have some sources lying around if you need (badly programmed) examples...
added on the 2007-11-26 18:09:43 by raer raer
I've been able to attach DSVideoLib to my demosystem and now all is working perfect. Thanks so much for all your help!
added on the 2007-11-29 13:22:53 by texel texel
webcam input into a demo system: I have our demo 'the evolution of vision' working with camera input, through opencv - the opensource project I normally use for image processing. It works ok.

added on the 2007-11-29 15:53:05 by Navis Navis

login

Go to top