简体   繁体   中英

Convert EmguCV image to system drawing bitmap

I am writing ac# program with emgucv library. I use the imagebox in emgucv to capture image from webcam. And I want to get the color pixel of the image by using bitmap.Getpixel() by mouse clicking the imagebox. However, it contain error The error is..it cannot implicitly convert type 'Emgu.CV.IImage' to '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.

However if you are using the Image class than you should maybe use the ToBitmap method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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