Webcam usage in C#

I’ve recently started doing some hobby work in this area.

We settled on using the OpenCV library with the opencvdotnet wrapper. It supports capturing frames from a webcam:

using (var cv = new OpenCVDotNet.CVCapture(0))
{
    var image = cv.CreateCompatibleImage();
    // ...
    cv.Release();
}

And if you’re doing image manipulation, OpenCV’s image processing algorithms have been wrapped within the OpenCVDotNet.Algs assembly.

If you decide to go this route be sure to install OpenCV version 1.0 (and install it to “c:\program files\opencv” if you are on Vista 64-bit, or “mklink OpenCV ‘c:\program files (x86)\OpenCV`” from the correct directory or else opencvdotnet will not install).

Leave a Comment