Monday, September 19, 2005

Video camera capture in managed code

If you’re running Windows XP, you can use a little-known XP feature called Windows Image Acquisition (WIA) that has a COM library you can program against. This makes capturing either a single frame of a picture or video stream from a USB web cam as easy as 1-2 lines of code.

MSDN Windows Image Acquisition docs –
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wiaaut/wia/wiax/overviews/startpagewiaaut.asp

Code Samples:
http://www.codeproject.com/dotnet/wiascriptingdotnet.asp
http://www.codeproject.com/csharp/webcamservice.asp (DirectShow wrapper)
http://www.codeproject.com/csharp/Motion_Detection.asp

There is also an open source project to program a webcam across any operating system that may interest you -
http://libusb.sourceforge.net/

Happy Coding!

No comments: