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

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

被折叠的 条评论
为什么被折叠?



