簡體   English   中英

將EmguCV圖像轉換為系統繪圖位圖

[英]Convert EmguCV image to system drawing bitmap

我正在用emgucv庫編寫ac#程序。 我使用emgucv中的圖像框從網絡攝像頭捕獲圖像。 我想通過使用bitmap獲取圖像的顏色像素。通過鼠標單擊圖像框獲取像素()。 但是,它包含錯誤錯誤是..它不能隱式地將類型'Emgu.CV.IImage'轉換為'System.Drawing.Bitmap'

任何人都可以給我解決這個問題的想法嗎?

      Bitmap bitmap = newdetectimageBox.Image; //error

請使用此代碼

 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);

IImage接口包含屬性Bitmap。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM