在通过NuGet包管理器安装Emgucv.runtime.windows之后,我找不到Emgucv ImageBox。我也尝试过在.NET框架组件列表中查找Emgucv dll文件作为可能的解决办法,但失败了(可以通过右键单击‘选择项目...’找到)。在通用工具箱下)。
我正在尝试使用VB.net访问我的网络摄像头,需要显示图像帧,最好是在Emgucv ImageBox中,而不是标准的.NET框架PictureBox中。
有没有找不到Emgucv ImageBox的原因?
下面是我的代码片段:
Public Class Form1
Dim imageCapture As Emgu.CV.VideoCapture = New Emgu.CV.VideoCapture
Dim image_mat As Mat = New Mat
Dim img As Emgu.CV.Image(Of Bgr, Byte)
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
REM things get messy here....
image_mat = Me.imageCapture.QueryFrame
img = image_mat.ToImage(Of Bgr, Byte)
REM I want to convert img into a compatible data type for the PictureBox1.Image since I do not have the Emgucv ImageBox
End Sub
End Class 发布于 2020-11-25 22:43:30
此解决方案是使用imageBox工具的替代方案。在Nuget Package Manager中,有一个额外的Emgu框架,用于将Emgu.CV.Mat数据类型转换为位图-它被称为Emgu.CV.Bitmap。
Imports Emgu.CV
Imports Emgu.CV.Structure
Public Class Form1
Dim imageCapture As Emgu.CV.VideoCapture = New Emgu.CV.VideoCapture
Dim image_mat As Emgu.CV.Mat = New Emgu.CV.Mat
Dim img As Emgu.CV.Image(Of Bgr, Byte)
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
image_mat = Me.imageCapture.QueryFrame
img = image_mat.ToImage(Of Bgr, Byte)
PictureBox1.Image = img.ToBitmap REM <---------
End Sub
End Class https://stackoverflow.com/questions/65004300
复制相似问题