Task task = new Task(() =>
{
Mat src = new Mat();
var capture = new VideoCapture();
//capture.Set(VideoCaptureProperties.FourCC, v.Value);
capture.Open(SBinfosMain.Cam2NameIndex);//打开指定的摄像头上
capture.Set(CaptureProperty.FrameWidth, 1280);//设定视频大小
capture.Set(CaptureProperty.FrameHeight, 720);
//FrameSource frame = capture.fra//Cv2.CreateFrameSource_Camera(0);
while (ThisIsRun)
{
//frame.NextFrame(src);
src = capture.RetrieveMat();
if (src.Empty()) continue;
//Invalidate();
Bitmap bitmap = BitmapConverter.ToBitmap(src);
Image ImageShow = bitmap;
if (PBXiazuo.IsHandleCreated)
{
PBXiazuo.Image = ImageShow;//将图片贴在数PicBox上
}
}
});
task.Start();