将EmguCV图像转换为系统绘图位图

use*_*617 3 c# winforms emgucv

我正在用emgucv库编写ac#程序.我使用emgucv中的图像框从网络摄像头捕获图像.我想通过使用bitmap获取图像的颜色像素.通过鼠标单击图像框获取像素().但是,它包含错误错误是..它不能隐式地将类型'Emgu.CV.IImage'转换为'System.Drawing.Bitmap'

任何人都可以给我解决这个问题的想法吗?

      Bitmap bitmap = newdetectimageBox.Image; //error
Run Code Online (Sandbox Code Playgroud)

vik*_*wal 5

请使用此代码

 Image<Bgr, Byte> ImageFrame = newdetectimageBox.Image ; //Capture the cam Image 
 Bitmap BmpInput = ImageFrame.ToBitmap(); //Convert the emgu Image to BitmapImage 
Run Code Online (Sandbox Code Playgroud)


hoo*_*zis 1

IImage 接口包含 Bitmap 属性。

但是,如果您使用的是 Image 类,那么您可能应该使用 ToBitmap 方法。