Question

What is The Easiest, fastest Way to capture video stream from camera with C#?

Was it helpful?

Solution

Simpliest and easiest probably would be using Microsoft Expression Encoder SDK:

static void Main( string[] args )
{
    var job = new Microsoft.Expression.Encoder.Live.LiveJob();
    job.AddDeviceSource( job.VideoDevices[0],job.AudioDevices[0] );
    var w = new System.Windows.Forms.Form();
    w.Show();
    var source = job.DeviceSources[0];
    source.PreviewWindow = new Microsoft.Expression.Encoder.Live.PreviewWindow( new System.Runtime.InteropServices.HandleRef(w, w.Handle) );
    Console.ReadKey();
}

OTHER TIPS

Take a look at DotImaging project on Github: https://github.com/dajuric/dot-imaging

var reader = new CameraCapture(); //create camera/file/image-directory capture
reader.Open();
var frame = reader.ReadAs<Bgr<byte>>(); //read single frame
reader.Close();

and more detailed sample: https://github.com/dajuric/dot-imaging/blob/master/Samples/Capture/Program.cs

NuGet package is available at: https://www.nuget.org/packages/DotImaging.IO/

It is pretty easy.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top