1

What library can you recommend to capture image from a webcam in .Net?

user26087
  • 809
  • 2
  • 13
  • 21

2 Answers2

1

DirectShow is pretty good. Look at this question here

Community
  • 1
  • 1
The.Anti.9
  • 43,474
  • 48
  • 123
  • 161
1

Windows Image Acquisition does the trick with wiaCommandTakePicture (VB.NET as per your tag :) )

as demonstrated in this project by Hanselman in coding4fun

I pasted the C# code, but you can read the VB.NET alternatives on the site also:

CommonDialogClass class1 = new CommonDialogClass();
Device d = class1.ShowSelectDevice(WiaDeviceType.UnspecifiedDeviceType, true,false);
if (d != null)
{
    settings.DeviceID = d.DeviceID;
    settings.Save();
}


Item item = device.ExecuteCommand(CommandID.wiaCommandTakePicture);
foreach (string format in item.Formats)
{
    if (format == jpegGuid)
    {
        WIA.ImageFile imagefile = item.Transfer(format) as WIA.ImageFile;
        filename = GetFreeFileName();
        if (string.IsNullOrEmpty(filename) == false)
        {
            imagefile.SaveFile(filename);
        }
        this.picLastImage.Load(filename);
        return filename;
    }
}
Ric Tokyo
  • 6,577
  • 3
  • 30
  • 48