vb.net - 使用 EMGU 从网络摄像头保存图片
问题描述
我想在 VB 2015 中修改我的程序,该程序使用网络摄像头捕获照片并将其保存到我的文件夹中。问题是它替换了拍摄的每张照片,我想用这种格式名称图片01、图片02等保存每张图片。
信息:我正在使用 Emgu。
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Try
PictureBox1.Image = capture.QueryFrame.ToBitmap()
Catch ex As Exception
capture = New Emgu.CV.Capture
End Try
End Sub
Private Sub startWebcam_Click(sender As Object, e As EventArgs) Handles startWebcam.Click
Timer1.Start()
End Sub
Private Sub captWebcam_Click(sender As Object, e As EventArgs) Handles captWebcam.Click
Dim picnumber As Integer = 0
Timer1.Stop()
'Save the picture
PictureBox1.Image.Save("D:\WEBCAM\Img01.JPEG", Imaging.ImageFormat.Jpeg)
capture.Dispose()
End Sub
解决方案
您还可以使用简单的整数增量:
Private FileID as Integer = 0
Private Sub captWebcam_Click(sender As Object, e As EventArgs) Handles captWebcam.Click
Timer1.Stop()
'Save the picture
FileID += 1
PictureBox1.Image.Save("D:\WEBCAM\Img" & FileID.ToString("00") & ".JPEG", Imaging.ImageFormat.Jpeg)
capture.Dispose()
End Sub
推荐阅读
- git - 如何在 jenkins sh 命令中使用 groovy 变量
- php - 没有 Hotelbeds SDK PHP 的 Hotelbeds API 可用性异常 java.lang.StackOverflowError
- c# - WCF双向调用:意外递归
- java - 带有 RestHighLevelClient 的 Elasticsearch Spring 数据
- angular - Angular 6无法读取未定义的属性'userEmail'
- javascript - 如何在mysql节点js中创建表?
- excel - 员工时间表与主管时间表一致的时间百分比
- laravel - 如何在 Laravel 中结合聚合 + 查找和搜索
- javascript - 使用 select2 框值过滤表
- node.js - 有没有办法在 node.js 中限制子进程对我的系统的访问?