Reputation: 125
I am writing a c# 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
Upvotes: 5
Views: 20227
Reputation: 202
Please use this code
Image<Bgr, Byte> ImageFrame = newdetectimageBox.Image ; //Capture the cam Image
Bitmap BmpInput = ImageFrame.ToBitmap(); //Convert the emgu Image to BitmapImage
Upvotes: 6
Reputation: 696
Here's how you do it (image data is NOT shared with the bitmap) - see documentation on emgu website about IImage :
Bitmap bitmap = new Bitmap(newdetectimageBox.Image.Bitmap);
Upvotes: 2
Reputation: 1737
The IImage interface contains property Bitmap.
However if you are using the Image class than you should maybe use the ToBitmap method.
Upvotes: 1