Fetch the repository succeeded.
VideoDeviceSource.cs
public void Start() {
if(_captureDevice == null)
{
requestStop = false;
//使用USB摄像机识别
_captureDevice = GetCaptureDevice();
//使用本地Resources目录下的720p.avi文件识别测试
//_captureDevice = GetFileVideoSource();
_captureDevice.NewFrame += _captureDevice_NewFrame; ;
_captureDevice.Start();
}
}
private void _captureDevice_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
if (requestStop) return;
Bitmap newFrame = (Bitmap)eventArgs.Frame.Clone();
//如果使用视频文件请注释下面的这行代码,表示不对图像进行水平翻转
newFrame.RotateFlip(RotateFlipType.Rotate180FlipY);
lock (sync)
{
if (currentFrame != null)
{
currentFrame.Dispose();
currentFrame = null;
}
currentFrame = newFrame;
_fps.Invoke(sender, newFrame);
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. Open source ecosystem
2. Collaboration, People, Software
3. Evaluation model