Video source for local video capture device (for example USB webcam).

Namespace:  AForge.Video.DirectShow
Assembly:  AForge.Video.DirectShow (in AForge.Video.DirectShow.dll) Version: 2.1.2.0 (2.1.2.0)

Syntax

C#
public class VideoCaptureDevice : IVideoSource

Remarks

The video source captures video data from local video capture device. DirectShow is used for capturing.

Sample usage:

CopyC#
// enumerate video devices
videoDevices = new FilterInfoCollection( FilterCategory.VideoInputDevice );
// create video source
VideoCaptureDevice videoSource = new VideoCaptureDevice( videoDevices[0].MonikerString );
// set NewFrame event handler
videoSource.NewFrame += new NewFrameEventHandler( video_NewFrame );
// start the video source
videoSource.Start( );
// ...
// signal to stop
videoSource.SignalToStop( );
// ...

private void video_NewFrame( object sender, NewFrameEventArgs eventArgs )
{
    // get new frame
    Bitmap bitmap = eventArgs.Frame;
    // process the frame
}

Inheritance Hierarchy

System..::.Object
  AForge.Video.DirectShow..::.VideoCaptureDevice

See Also