Compartilhar via


The little-known Windows Image Acquisition (WIA): images from devices to XP in a few lines of code

One of my projects in a former life involved streaming video data off a webcam in real-time to make pretty things happen.

I used DirectShow at the time, but yesterday I was introduced to Windows Image Acquisition (WIA), a little-known interface that makes it very easy to capture still images from a video stream.

WIA is really easy to program against, but it's hardly a "reach" solution - it only works against Windows XP.  The latest version of WIA, 2.0, only works with Windows XP Service Pack 1 or later.

Unfortunately, after an evening's investigation, I couldn't get WIA to do what I wanted: namely, to "raise events" when frames came in, so I could obtain a steady, 20+ frames-per-second harvest of live video frames from my webcam.  If anyone knows how to do something like that, I'm all ears.

Meanwhile, if you're looking for a quick and easy way to capture frames off a device (in literally a few lines of code) here's more information on WIA:

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

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

Many thanks to Dan Fernandez for the pointers.

Comments