Fun with Webcams (Windows only), source code! test filter kernels on live video

Hi

Based on a public domain frame grabbing library called VideoInput I modified the NVIDIA box filter SDK sample to process live video.

VideoInput is compatible with Windows only at this time. This will compile on Visual Studio 2005 using the CUDA SDK 2.0. Unfortunately the VideoInput library shipped as .LIB file and not as a DLL so I have to provide quite some extra .lib files to satisfy linker dependencies - blowing up the download to 3.8 MB.

Any blurriness is caused by the box filter kernel - this is intentional.

Use the +,- keys to adjust box filter width.
Use the keys to adjust the number of filter iterations.

Replace or modify the kernel as you like. The input data format is RGBA, also bound to a 2D texture. The kernel’s output format currently seems to be float (it appears to be necessary to use a pixel shader for displaying this).

If you have a premium web cam, say a Logitech 9000 model you can capture at up to 2 megapixel resolution by specifying capture resolutions higher than 640x480 in the source code. This is where CUDA will really shine, because a CPU couldn’t really do the same filtering in real time.

One more thing. With this kernel the image width and height should be a multiple of nthreads - so if you capture at 320 x 240, set nthreads to 16 or you will get some garbage at the right or bottom border.

BTW the home page for VideoInput is here [url=“videoInput Library”]http://muonics.net/school/spring05/videoInput/[/url]

EDIT: large file downloads from the forum are currently not working, so I’ve removed the attachment entirely.

Christian

it looks like I will have to install VS on my laptop (do you know if the program works in Vista? I have a nice Logitech cam & 8600M GT External Image

This should work on Vista.

But the box filter effect itself is just an unspectacular blur. It’s really just meant as a starting point for to plug in your own kernels. ;)

BTW there is room for improvement: I had to do one quite slow CPU conversion from 24 bit RGB to 32 bit RGBA which could also be done with a CUDA kernel.

Hi,

unforunately I don’t have a webcam, but as far as I remember from friends their quality is often rather poor and noisy. So if I had one, the denoising examples would be my next step … :D

Elmar

The old ones really are terrible, but some of the newer ones are 1.3 and 2.0 megapixels, and have a halfway decent picture.

The higher priced ($50 and above) Microsoft and Logitech webcams are decent. They make use of the higher USB 2.0 bandwidth to get good framerates at 640x480 pixels and higher.

Video capture can also work with video frame grabbers - it doesn’t have to be a webcam. You could even replay/capture an entire movie through VirtualDub and the AviSynth frame server.

Please reupload your file. I have problems downloading it. Thank you very much.

Ah yes the server was not providing the full 3.8 MB for the file, resulting in a broken download.

I’ve re-uploaded the .zip file.

Note that there is a new version of the VideoInput library available from the author’s web site

And the dependencies on Visual C++ 2005 runtime don’t help either when all you’ve got is

a Visual C++ 2008 version. But it should be possible to recompile the EXE with the 2008 version,

based on all the .lib files I provide.

Christian

Thank you for your effort but i can not still download the zip file. Download stops at 2.5-2.8 MB-s.

Thanks,

Pavle

What a pity. I may try to convert the archive to .7z format (which I can then attach with .zip file extension only) - it should bring the file size down to less than 2 MB.

Does anybody have the code/download from this topic? The attachment was removed and I could really use it for a project.
Please write me, if you have the code.
Thanks

Somewhat related, I just saw this cool CUDA-based camera tracking project here (with source):
[url=“UMass Graphics & Vision Research: Realtime Tracking With a Pan-Tilt Camera”]http://umassgv.blogspot.com/2010/07/realti...ilt-camera.html[/url]

Hi Christian,

Viewing this thread now. Can you upload the attachement again?

Regards,