2013-03-14 40 views
3

我正在用emgucv庫編寫一個c#程序。 我使用emgucv中的圖像框從網絡攝像頭捕捉圖像。 我想通過使用bitmap.Getpixel()通過鼠標點擊圖像框來獲取圖像的顏色像素。 然而, 它包含錯誤的錯誤is..it不能隱式轉換類型「Emgu.CV.IImage」到「System.Drawing.Bitmap」將EmguCV圖像轉換爲系統繪製位圖

誰能給我的想法來解決這個問題?

 Bitmap bitmap = newdetectimageBox.Image; //error 

回答

1

IImage接口包含屬性位圖。

但是,如果您使用的Image類比您應該使用ToBitmap方法。

2

這裏是你如何做到這一點(圖像數據不與位圖共享) - 見emgu網站約IImage文檔:

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

請使用此代碼

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

從文檔://備註: //爲了在Image 和Image 上獲得更好的性能,請考慮使用 // Bitmap屬性 – ephraim 2017-07-25 07:05:19