简体   繁体   English

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

[英]Convert EmguCV image to system drawing bitmap

I am writing ac# program with emgucv library. 我正在用emgucv库编写ac#程序。 I use the imagebox in emgucv to capture image from webcam. 我使用emgucv中的图像框从网络摄像头捕获图像。 And I want to get the color pixel of the image by using bitmap.Getpixel() by mouse clicking the imagebox. 我想通过使用bitmap获取图像的颜色像素。通过鼠标单击图像框获取像素()。 However, it contain error The error is..it cannot implicitly convert type 'Emgu.CV.IImage' to 'System.Drawing.Bitmap' 但是,它包含错误错误是..它不能隐式地将类型'Emgu.CV.IImage'转换为'System.Drawing.Bitmap'

Can anyone give me idea to solve this problem? 任何人都可以给我解决这个问题的想法吗?

      Bitmap bitmap = newdetectimageBox.Image; //error

Please use this code 请使用此代码

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

以下是您的操作方法(图像数据不与位图共享) - 请参阅emgu网站上关于IImage的文档:

Bitmap bitmap = new Bitmap(newdetectimageBox.Image.Bitmap);

The IImage interface contains property Bitmap. IImage接口包含属性Bitmap。

However if you are using the Image class than you should maybe use the ToBitmap method. 但是,如果您使用的是Image类,则应使用ToBitmap方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM