什么是使用C#捕获摄像头视频流的最简单、最快速的方法?
最简单和最容易的方法可能是使用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();
}
请在Github上查看DotImaging项目: 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();