您好,欢迎光临本网站![请登录][注册会员]  
文件名称: AForge.NET Framework-2.2.5.zip视频资源捕获C#封装流行控件
  所属分类: C#
  开发工具:
  文件大小: 35mb
  下载次数: 0
  上传时间: 2014-11-27
  提 供 者: yuji****
 详细说明: C#摄像头资源获取、录制视频、音频、拍摄照片等 下载lib之后,引用就可以了 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using AForge.Video; using AForge.Video.DirectShow; namespace 视频 { public partial class Form1 : Form { private bool DeviceExist = false; private FilterInfoCollection videoDevices; private VideoCaptureDevice videoSource = null; private Timer timer1 = new Timer(); public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { getCamList(); } private void getCamList() { try { videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); comboBox1.Items.Clear(); if (videoDevices.Count == 0) throw new ApplicationException(); DeviceExist = true; foreach (FilterInfo device in videoDevices) { comboBox1.Items.Add(device.Name); } comboBox1.SelectedIndex = 0; //make dafault to first cam } catch (ApplicationException) { DeviceExist = false; comboBox1.Items.Add("No capture device on your system"); } } private void CloseVideoSource() { if (!(videoSource == null)) if (videoSource.IsRunning) { videoSource.SignalToStop(); videoSource = null; } } private void video_NewFrame(object sender, NewFrameEventArgs eventArgs) { Bitmap img = (Bitmap)eventArgs.Frame.Clone(); //do processing here pictureBox1.Image = img; //pictureBox1.Image. } private void timer1_Tick(object sender, EventArgs e) { label2.Text = "Device running... " + videoSource.FramesReceived.ToString() + " FPS"; } private void Form1_FormClosed(object sender, FormClosedEventArgs e) { CloseVideoSource(); } private void btnPlay_Click(object sender, EventArgs e) { if (DeviceExist) { videoSource = new VideoCaptureDevice(videoDevices[comboBox1.SelectedIndex].MonikerString); videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame); CloseVideoSource(); videoSource.DesiredFrameSize = new Size(pictureBox1.Width, pictureBox1.Height); //videoSource.DesiredFrameSize = new Size(353, 290); //videoSource.DesiredFrameRate = 10; videoSource.Start(); label2.Text = "Device running..."; timer1.Enabled = true; } else { label2.Text = "Error: No Device selected."; } } private void btnStop_Click(object sender, EventArgs e) { if (videoSource.IsRunning) { timer1.Enabled = false; CloseVideoSource(); label2.Text = "Device stopped."; } } private void btnExit_Click(object sender, EventArgs e) { CloseVideoSource(); this.Dispose(); } } } C#使用Aforge.net framework采集摄像头视频 这样,一个简单的摄像头视频程序便可以使用了。 ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: AForge 视频 摄像头 音频 拍照
 输入关键字,在本站1000多万海量源码库中尽情搜索: