【问题标题】:How to convert Capture to Image<Bgr,Byte> using Emgu library如何使用 Emgu 库将 Capture 转换为 Image<Bgr,Byte>
【发布时间】:2016-02-23 06:19:21
【问题描述】:

我正在努力使用 C# 中的 Emgu 库将 Capture 转换为 Image。我知道 Emgu 网站上有代码示例,但这些不涉及相机捕捉。我想对来自相机的帧进行一些处理。

这是我目前所拥有的:

Capture capture = null;
capture = new Capture(); //create a camera capture
capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.Fps, 30);
capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameHeight, 240);
capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameWidth, 320); 
viewer.Image = capture.QueryFrame()
viewer.ShowDialog();

我希望能够在以下行中使用捕获:

Image<Gray, Byte> gray = capture.Convert<Gray, Byte>().PyrDown().PyrUp();

谢谢

【问题讨论】:

  • 只是为了更新我已经使用了link 但是当我尝试重建它时抱怨 无法将类型 'Emgu.CV.Mat' 隐式转换为 'Emgu.CV.Image'

标签: c# image-processing emgucv


【解决方案1】:

我认为,如果您有一个 Mat 并且想要一个 Image,您可以执行以下操作:

Image<Bgr, Byte> img = new Image<Bgr, Byte>(theMat.Bitmap);

道格

【讨论】:

  • 谢谢!此外,我发现以下行也可以完成这项工作:Capture capture2 = new Capture();Mat capMat= capture2.QueryFrame();Image&lt;Bgr, byte&gt; image = capMat.ToImage&lt;Bgr, byte&gt;();
猜你喜欢
  • 1970-01-01
  • 2012-08-28
  • 2017-12-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多