加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

在VB.NET安装EMGU步骤

发布时间:2020-12-16 22:46:24 所属栏目:大数据 来源:网络整理
导读:下载并安装EMGU http://sourceforge.net/projects/emgucv/ 项目-解决方案资源管理器,然后在解决方案资源管理器 对windowsapplication1点右键 属性 引用 ,添加在EMGU安装目录下 emgucv-windows-x86 2.3.0.1416bin的emgu.cv.dll和emgu.util.dll两个文件。 类
下载并安装EMGU http://sourceforge.net/projects/emgucv/
项目-解决方案资源管理器,然后在解决方案资源管理器 对windowsapplication1点右键 属性 引用 ,添加在EMGU安装目录下 emgucv-windows-x86 2.3.0.1416bin的emgu.cv.dll和emgu.util.dll两个文件。
类似其他Emgu.CV.GPU.dll之类的也可以引用,具体看需求了。之后将的emgu.cv.dll和emgu.util.dll拷入.exe的目录下


贴入下面代码,我在win7 vs2008 VB.net 下运行顺利


Imports Emgu.CV
Imports Emgu.CV.CvEnum
Imports Emgu.CV.Structure

Public Class Form1

Private Sub Form1_Load(sender As System.Object,e As System.EventArgs) Handles MyBase.Load
'The name of the window
Dim win1 = "Test Window"

'Create the window using the specific name
CvInvoke.cvNamedWindow(win1)

'Create an image of 400x200 of Blue color
Using img As Image(Of Bgr,Byte) = New Image(Of Bgr,Byte)(400,200,New Bgr(255,0))

'Create the font
Dim f = New MCvFont(Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_COMPLEX,1.0,1.0)
'Draw "Hello,world." on the image using the specific font
img.Draw("Hello,world",f,New Point(10,80),New Bgr(0,255,0))

'Show the image
CvInvoke.cvShowImage(win1,img.Ptr)
'Wait for the key pressing event
CvInvoke.cvWaitKey(0)
'Destory the window
CvInvoke.cvDestroyWindow(win1)
End Using
End Sub
End Class


不过目前想尝试使用VB自带的picbox控件加载图片,使用cvinvoke的方法处理时,会提示类型不同。正在解决中


附emgu函数说明

Function Mapping - Emgu.CV.CvInvoke

The CvInvoke class provides a way to directly invokeOpenCVfunction within .NET languages. Each method in this class corresponds to a function inOpenCVof the same name. For example,a call to

 IntPtr image = CvInvoke.cvCreateImage(new System.DrawingSize(400,300),CvEnumIPL_DEPTHIPL_DEPTH_8U,0)">1);
is equivalent to the following function call in C
 IplImage* image = cvCreateImage(cvSize(400, 300)1;

Both of which create a 400x300 of 8-bit unsigned grayscale image.

Structure Mapping - Emgu.CV.Structure.Mxxx

This type of structure is a direct mapping toOpenCVstructures.

Emgu CVStructure OpenCVstructure
Emgu.CV.Structure.MIplImage IplImage
Emgu.CV.Structure.MCvMat CvMat
... ...
Emgu.CV.Structure.Mxxxx xxxx

The prefixMhere stands for Managed structure.

Emgu CValso borrows some existing structures in .Net to represent structures inOpenCV:

.Net Structure OpenCVstructure
System.Drawing.Point CvPoint
System.Drawing.PointF CvPoint2D32f
System.Drawing.Size CvSize
System.Drawing.Rectangle CvRect

Enumeration Mapping - Emgu.CV.CvEnum

The CvEnum namespace provides direct mapping toOpenCVenumerations. For example,CvEnum.IPL_DEPTH.IPL_DEPTH_8Uhas the same value asIPL_DEPTH_8UinOpenCV; both of which equals8.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读