views:

7343

answers:

6

I want to connect to a USB Webcam in .NET, specifically using C#. Being new to .NET I don't know what kind of support there is in the standard libraries for doing so. I found one example on the web that copies bitmaps through the clipboard, but that seems very hacky (and probably slow). Is there a better way?

+9  A: 
spoon16
+2  A: 

Here is nice example of doing this. It's using DirectShow.Net (http://directshownet.sourceforge.net/), which is propably better than using "clipboard" :D.

http://www.codeproject.com/KB/audio-video/WebcamUsingDirectShowNET.aspx

Crank
A: 

On my computer, WIA was painstakingly sloooow... so i decided to give the Windows Multimedia Video Capture a try.

You can find a demo here.

timvw
A: 

It really depends on what you want to do. WIA is primarily for capturing stills from imaging devices, and DirectShow (used either through directshow.net or managed DirectX) is for access to fuller video features.

The other option is to create a WPF application. It has a huge amount of built in support for video (to the extent that having a looping video clip as a button is pretty trivial), and should be quick and easy to develop.

Sneaky
+4  A: 

Interesting side note, WIA isn't supported by Vista for doing Captures from Webcams anymore. They mainly targeted it towards Scanners and pulling stills from cameras.

Also, larger manufacturers like logitech have abandoned WIA is favor of DirectShow.

JoelHess
A: 

Theres a package with functions with a lot of things to do with computer vision systems called AForge. And they have an easy way to get webcam images from a USB camera if you're still looking.

Just check out the sample code for computer vision motion sensor example code. I'm sure you can pull out the function calls you need from it as I did.

[sorry to necro, but this could be of use to someone in the future]

Kurru
Nothing wrong with adding useful info later -- this isn't Usenet :)
egrunin