C# 打开摄像头录像,录像文件保存到本地, 支持时间戳,支持 64位
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-12-28 11:36 时间戳、摄像头
目录 0 2018-12-28 11:36 时间戳、摄像头.vs
目录 0 2018-12-28 11:36 时间戳、摄像头.vsTEST_CV3.2
目录 0 2018-12-28 11:36 时间戳、摄像头.vsTEST_CV3.2v14
文件 42496 2018-12-28 11:36 时间戳、摄像头.vsTEST_CV3.2v14.suo
目录 0 2018-12-28 11:35 时间戳、摄像头TEST_CV3.2
文件 189 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2App.config
文件 4936 2018-12-28 11:30 时间戳、摄像头TEST_CV3.2Form1.Designer.cs
文件 7059 2018-12-28 11:35 时间戳、摄像头TEST_CV3.2Form1.cs
文件 5817 2018-12-28 11:30 时间戳、摄像头TEST_CV3.2Form1.resx
文件 601 2018-11-02 09:23 时间戳、摄像头TEST_CV3.2frameDataModel.cs
文件 523 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2Program.cs
目录 0 2018-10-24 15:52 时间戳、摄像头TEST_CV3.2Properties
文件 1328 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2PropertiesAssemblyInfo.cs
文件 2835 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2PropertiesResources.Designer.cs
文件 5612 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2PropertiesResources.resx
文件 1098 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2PropertiesSettings.Designer.cs
文件 249 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2PropertiesSettings.settings
文件 4834 2018-10-29 14:26 时间戳、摄像头TEST_CV3.2TEST_CV3.2.csproj
目录 0 2018-10-24 15:52 时间戳、摄像头TEST_CV3.2in
目录 0 2018-11-13 15:38 时间戳、摄像头TEST_CV3.2inDebug
文件 8192 2017-05-07 06:40 时间戳、摄像头TEST_CV3.2inDebugEmgu.CV.DebuggerVisualizers.VS2015.dll
文件 27136 2017-05-07 06:40 时间戳、摄像头TEST_CV3.2inDebugEmgu.CV.UI.GL.dll
文件 118272 2017-05-07 06:39 时间戳、摄像头TEST_CV3.2inDebugEmgu.CV.UI.dll
文件 609280 2017-05-07 06:39 时间戳、摄像头TEST_CV3.2inDebugEmgu.CV.World.dll
文件 56624 2015-07-07 00:51 时间戳、摄像头TEST_CV3.2inDebugMicrosoft.VisualStudio.DebuggerVisualizers.dll
文件 11776 2018-12-28 11:35 时间戳、摄像头TEST_CV3.2inDebugTEST_CV3.2.exe
文件 189 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2inDebugTEST_CV3.2.exe.config
文件 24064 2018-12-28 11:35 时间戳、摄像头TEST_CV3.2inDebugTEST_CV3.2.pdb
文件 22688 2018-12-28 11:36 时间戳、摄像头TEST_CV3.2inDebugTEST_CV3.2.vshost.exe
文件 189 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2inDebugTEST_CV3.2.vshost.exe.config
............此处省略26个文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using System.IO;
using System.Diagnostics;
using System.Collections.Concurrent;
using System.Threading;
namespace TEST_CV3._2
{
public partial class Form1 : Form
{
private ConcurrentQueueameDataModel> _queframes = null;
//private Task _taskWriter = null;
private CancellationTokenSource _ctsTaskWriter = new CancellationTokenSource();
public Form1()
{
InitializeComponent();
Image image = new Image(1280 720 new Bgr(50 10 1)); //创建一张320*240尺寸颜色为红色的图像。 // Image image = new Image(@“D:2.jpg“); //从文件加载图片
imageBox1.Image = image;
videoSize = new Size(640 480);
//videoOutput = new VideoWriter(videoPath 4 120 videoSize true);
_queframes = new ConcurrentQueueameDataModel>();
}
private bool _captureStoped = true;
private string videoPath;
VideoCapture Cap_cam;
Size videoSize;
VideoWriter videoOutput;
private string drawDate3;
Mat frame;
private void Form1_Load(object sender EventArgs e)
{
//_taskWriter = new Task(() =>
//{
// WriteVideo();
//});
}
private DateTime _playTime = DateTime.Now;
private double _frameTimeSpan = 0;
private void Capture_ImageGrabbed(object sender EventArgs e)
{
if (!_captureStoped)
{
frame = new Mat();
Cap_cam.Retrieve(frame 0); //接收数据
//VideoWriter.
imageBox1.Image = frame; //显示图像
//写到屏幕上的时间
DateTime now = DateTime.Now;
//_queframes.Enqueue(new frameDataModel() { frameTime = DateTime.Now frame = frame });
int timeStampCurrent = now.Hour * 360000 + now.Minute * 6000 + now.Second * 100 + (int)now.Millisecond / 10;
string drawDate1 = now.ToString(“HH:mm:ss“);
string drawDate2 = now.ToString(timeStampCurrent.ToString(“00000000“));
CvInvoke.PutText(frame drawDate1 new Point(0 40) FontFace.HersheyTriplex 1 new MCvScalar(255 0 255) 2);
CvInvoke.PutText(frame drawDate2 new Point(0 100) FontFace.HersheyTriplex 1 new MCvScalar(255 0 255) 2);
_frameTimeSpan = (DateTime.Now - _playTime).TotalMilliseconds;
_playTime = DateTime.
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-12-28 11:36 时间戳、摄像头
目录 0 2018-12-28 11:36 时间戳、摄像头.vs
目录 0 2018-12-28 11:36 时间戳、摄像头.vsTEST_CV3.2
目录 0 2018-12-28 11:36 时间戳、摄像头.vsTEST_CV3.2v14
文件 42496 2018-12-28 11:36 时间戳、摄像头.vsTEST_CV3.2v14.suo
目录 0 2018-12-28 11:35 时间戳、摄像头TEST_CV3.2
文件 189 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2App.config
文件 4936 2018-12-28 11:30 时间戳、摄像头TEST_CV3.2Form1.Designer.cs
文件 7059 2018-12-28 11:35 时间戳、摄像头TEST_CV3.2Form1.cs
文件 5817 2018-12-28 11:30 时间戳、摄像头TEST_CV3.2Form1.resx
文件 601 2018-11-02 09:23 时间戳、摄像头TEST_CV3.2fr
文件 523 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2Program.cs
目录 0 2018-10-24 15:52 时间戳、摄像头TEST_CV3.2Properties
文件 1328 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2PropertiesAssemblyInfo.cs
文件 2835 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2PropertiesResources.Designer.cs
文件 5612 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2PropertiesResources.resx
文件 1098 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2PropertiesSettings.Designer.cs
文件 249 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2PropertiesSettings.settings
文件 4834 2018-10-29 14:26 时间戳、摄像头TEST_CV3.2TEST_CV3.2.csproj
目录 0 2018-10-24 15:52 时间戳、摄像头TEST_CV3.2in
目录 0 2018-11-13 15:38 时间戳、摄像头TEST_CV3.2inDebug
文件 8192 2017-05-07 06:40 时间戳、摄像头TEST_CV3.2inDebugEmgu.CV.DebuggerVisualizers.VS2015.dll
文件 27136 2017-05-07 06:40 时间戳、摄像头TEST_CV3.2inDebugEmgu.CV.UI.GL.dll
文件 118272 2017-05-07 06:39 时间戳、摄像头TEST_CV3.2inDebugEmgu.CV.UI.dll
文件 609280 2017-05-07 06:39 时间戳、摄像头TEST_CV3.2inDebugEmgu.CV.World.dll
文件 56624 2015-07-07 00:51 时间戳、摄像头TEST_CV3.2inDebugMicrosoft.VisualStudio.DebuggerVisualizers.dll
文件 11776 2018-12-28 11:35 时间戳、摄像头TEST_CV3.2inDebugTEST_CV3.2.exe
文件 189 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2inDebugTEST_CV3.2.exe.config
文件 24064 2018-12-28 11:35 时间戳、摄像头TEST_CV3.2inDebugTEST_CV3.2.pdb
文件 22688 2018-12-28 11:36 时间戳、摄像头TEST_CV3.2inDebugTEST_CV3.2.vshost.exe
文件 189 2018-10-23 16:15 时间戳、摄像头TEST_CV3.2inDebugTEST_CV3.2.vshost.exe.config
............此处省略26个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)