資源簡介
c#操作攝像頭(帶著usb攝像頭、mjpeg-streamer的uvc攝像頭、網絡h264攝像頭)
win原生的、codeProject的一個框架、AForge的攝像頭;mjpeg的linux-uvc攝像頭(智能小車那種)、網絡攝像頭
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
//
//
using?System.Drawing;
using?System.Drawing.Imaging;
using?System.Windows.Forms;
using?System.Threading;
using?System.Diagnostics;
using?AForge;
using?AForge.Video;
using?AForge.Controls;
using?AForge.Video.DirectShow;
using?AForge.Video.FFMPEG;
using?AForge.Imaging;
using?AForge.Imaging.Filters;
using?System.IO;
namespace?攝像頭
{
????///?
????///?用aforge控制攝像頭
????///?參考網址:https://www.cnblogs.com/wangzhenghua/p/4481069.html
????///?
????public?partial?class?FrmAForge?:?Form
????{
????????private?FilterInfoCollection?videoDevices;
????????private?VideoCaptureDevice?videoSource;
????????private?bool?stopREC?=?true;
????????private?bool?createNewFile?=?true;
????????private?string?videoFileFullPath?=?string.Empty;?//視頻文件全路徑
????????private?string?imageFileFullPath?=?string.Empty;?//圖像文件全路徑
????????private?string?videoPath?=?@“E:\video\“;?//視頻文件路徑
????????private?string?videoFileName?=?string.Empty;?//視頻文件名
????????private?string?imageFileName?=?string.Empty;?//圖像文件名
????????private?string?drawDate?=?string.Empty;
????????private?VideoFileWriter?videoWriter?=?null;
????????public?delegate?void?MyInvoke();?//定義一個委托方法
????????string?g_s_AutoSavePath?=?AppDomain.CurrentDomain.baseDirectory?+?“Capture\\“;
????????object?objLock?=?new?object();?//定義一個對象的鎖
????????int?frameRate?=?20;?//默認幀率
????????private?Stopwatch?stopWatch?=?null;
????????IVideoSource?iVideoSource?=?null;
????????private?int?flag?=?0;
????????public?AForge.Controls.VideoSourcePlayer?videoPlayer?=?null;????//攝像頭:預覽窗口
????????public?FrmAForge()
????????{
????????????InitializeComponent();
????????}
????????private?void?FrmAForge_Load(object?sender?EventArgs?e)
????????{
????????????try
????????????{
????????????????//?枚舉所有視頻輸入設備
????????????????videoDevices?=?new?FilterInfoCollection(FilterCategory.VideoInputDevice);
????????????????if?(videoDevices.Count?==?0)
????????????????????throw?new?ApplicationException();
????????????????foreach?(FilterInfo?device?in?videoDevices)
????????????????{
????????????????????tscbxCameras.Items.Add(device.Name);
????????????????}
????????????????tscbxCameras.SelectedIndex?=?0;
????????????}
????????????catch?(ApplicationException)
????????????{
????????????????tscbxCameras.Items.Add(“No?local?capture?devices“);
????????????????videoDevices?=?null;
????????????}
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????CameraConn();
????????}
????????private?void?CameraConn()
????????{
????????????videoSource?=?new?VideoCaptureDevice(videoDevices[tscbxCameras.SelectedIndex].MonikerString);
????????????videoSource.DesiredframeSize?=?new?Size(320?240);
????????????videoSource.DesiredframeRate?=?1;
????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????8398??2018-01-29?16:55??FrmCodeProj.Designer.cs
?????文件???????6190??2018-01-29?16:55??FrmCodeProj.resx
?????文件???????2089??2018-04-10?18:22??FrmMain.cs
?????文件???????9757??2018-04-10?18:11??FrmMain.Designer.cs
?????文件???????6185??2018-04-10?18:11??FrmMain.resx
?????文件???????9368??2018-04-10?18:21??FrmNetCam.cs
?????文件???????4908??2018-04-10?18:21??FrmNetCam.Designer.cs
?????文件???????6473??2018-04-10?18:21??FrmNetCam.resx
?????文件???????3455??2018-02-01?10:41??FrmOpenWrtUVC.cs
?????文件???????7078??2018-02-01?10:40??FrmOpenWrtUVC.Designer.cs
?????文件???????6379??2018-02-01?10:40??FrmOpenWrtUVC.resx
?????文件???????2028??2018-01-12?23:36??FrmWinNative.cs
?????文件???????5855??2017-12-12?22:04??FrmWinNative.Designer.cs
?????文件???????5817??2017-12-12?22:04??FrmWinNative.resx
?????文件???????4583??2018-01-29?16:56??FrmWinNative2.cs
?????文件???????3745??2018-01-29?16:56??FrmWinNative2.Designer.cs
?????文件???????5817??2018-01-29?16:56??FrmWinNative2.resx
?????文件????????492??2017-12-12?17:55??Program.cs
?????文件???????7846??2018-04-10?18:00??攝像頭.csproj
?????文件???????2111??2017-12-12?22:14??攝像頭.sln
????..A..H.?????97792??2018-01-12?23:57??攝像頭.v12.suo
?????文件???????1725??2017-12-12?18:04??攝像頭AForge.cs
?????文件???????6748??2018-01-12?23:45??原生Camera.cs
?????文件??????12182??2017-12-13?09:38??iPublic\Gs_Class.cs
?????文件??????12001??2017-12-12?17:20??iPublic\iCamera2015.cs
?????文件???????8225??2018-04-10?18:22??iPublic\VideoForm.cs
?????文件???????4281??2018-04-10?18:22??iPublic\VideoForm.Designer.cs
?????文件???????6012??2018-04-10?18:22??iPublic\VideoForm.resx
?????文件??????48814??2018-04-10?18:06??iPublic\XMSDK.cs
?????文件??????50117??2018-04-10?18:22??obj\Debug\DesignTimeResolveAssemblyReferences.cache
............此處省略299個文件信息
- 上一篇:影像同名點提取
- 下一篇:學生學籍管理系統(tǒng)(C#+Access)
評論
共有 條評論