Aforge.net framework采集摄像头视频

时间:2023-01-31 21:11:06

C#使用Aforge.net framework采集摄像头视频

Aforge.net framework采集摄像头视频 (2010-08-20 22:24:32)
标签:

c

aforge

摄像头

it

 

对于视频编程,网络上的东西不是很好找,摄像头算是比较初级的东东了,我查了很多资料,才算是有一点结果,现在把摄像头采集程序代码与大家分享一下。(vs2008编译通过)

其中,Aforge.net下载地址http://www.aforgenet.com/framework/

下载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 视频
{
    publicpartial 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 voidgetCamList()       
       {           
           try           
           {               
               videoDevices = newFilterInfoCollection(FilterCategory.VideoInputDevice);               
               comboBox1.Items.Clear();              
               if (videoDevices.Count ==0)                  
                   throw newApplicationException();              
               DeviceExist =true;              
               foreach (FilterInfo device invideoDevices)