Vb.net Emgu图像识别处理常用函数

该博客展示了用于图像处理的一系列函数,包括缩放、保存、打开、阈值处理、比较、去除噪点、模糊、中值滤波、高斯滤波、颜色反转、轮廓增强、转换为数组及数组转回Mat、选择区域、裁剪以及在图像上绘制文字和矩形等操作。这些函数涵盖了图像预处理和分析的基础步骤。

Sub MatView(ByRef M As Mat, Pic As PictureBox, Optional Full As Boolean = False)
    If M.Height <= Pic.Height AndAlso M.Width <= Pic.Width Then Pic.Image = M.ToBitmap() : Return
    If Full Then Pic.Image = M.ToBitmap() : Pic.Width = M.Width : Pic.Height = M.Height : Return

    Dim R As New Mat, scale As Double = M.Height / M.Width
    CvInvoke.Resize(M, R, New Size(Pic.Height / scale, Pic.Height)) '缩放
    Pic.Width = R.Width
    Pic.Height = R.Height

    Pic.Image = R.ToBitmap()
  End Sub
  Sub SaveMat(ByRef M As Mat, Optional FileName As String = "", Optional FileDir As String = "")
    Dim Path As String = AppPath & "\Mat\" & Now.ToString("yyyy-MM-dd") & "\"
    If FileDir <> "" Then Path = AppPath & "\Pick\" & FileDir & "\"
    If IO.Directory.Exists(Path) = False Then IO.Directo

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值