资源简介

封装了一个DLL,源码在项目工程里,调用非常简单方便 msxt = new mSheXiangTou(pictureBox1); List temp = null; if ((temp = msxt.GetVideoDevicesNameList) != null) { foreach (string str in temp) { comboBox1.Items.Add(str); } comboBox1.SelectedIndex = 0; } Open.Click += new EventHandler(Open_Click); Close.Click += new EventHandler(msxt.Close_Click); LuXiang.Click += new EventHandler(msxt.LuXiang_Click); Stop.Click += new EventHandler(msxt.TingZhi_Click); PaiZhao.Click += new EventHandler(msxt.PaiZhao_Click); FormClosing += new FormClosingEventHandler(msxt.Form_FormClosing);

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;

using AForge.Video.DirectShow;
using AForge.Video;
using AForge.Video.FFMPEG;
using System.IO;

namespace SheXiangTou
{
    public class mSheXiangTou
    {
        public List GetVideoDevicesNameList
        {
            get
            {
                return videoList;
            }
        }
        public bool SetShowTime
        {
            set { isShowTime = value; }
        }
        public string SetVideoSavePath
        {
            set { videoSavePath = value; }
        }
        public string SetPictureSavePath
        {
            set { pictureSavePath = value; }
        }
        public int GetframesReceived
        {
            get { return videoSource.framesReceived; }
        }

        private FilterInfoCollection videoDevices;
        private VideoFileWriter writer = new VideoFileWriter();
        private VideoCaptureDevice videoSource = null;
        private System.Diagnostics.Stopwatch timer = null;
        private Bitmap bitmap;
        private Font font = new Font(“宋体“ 20);
        private SolidBrush sbrush = new SolidBrush(Color.Yellow);
        private PointF strpoint = new PointF(10 10);
        private Graphics g = null;
        private List videoList = null;
        private bool isOpen = false;
        private bool isLuxiang = false;
        private bool isPaizhao = false;
        private bool isShowTime = false;
        private PictureBox picture = null;

        private string videoSavePath = “video\\“;
        private string pictureSavePath = “picture\\“;

        public mSheXiangTou(PictureBox pb)
        {
            picture = pb;

            if (picture == null)
            {
                throw new Exception(“传入的PictureBox类型参数是NULL“);
            }

            GetVideo();

            CheckPath();
        }

        /// 
        /// 检查路径
        /// 

        private void CheckPath()
        {
            DirectoryInfo fInfo = null;
            fInfo = new DirectoryInfo(videoSavePath);
            if (!fInfo.Exists)
            {
                Directory.CreateDirectory(videoSavePath);
            }
            fInfo = new DirectoryInfo(pictureSavePath);
            if (!fInfo.Exists)
            {
                Directory.CreateDirectory(pictureSavePath);
            }
        }

        /// 
        /// 获得摄像头设备
        /// 

        public void GetVideo()
        {
            try
            {
                videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
                if (videoDevices.Count == 0)
                {
                    MessageBox.Show(“没有发现任何摄像头设备“);
                    return;
                }
                videoList = null;
                videoL

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       7680  2015-05-22 00:17  SheXiangTouTest\SheXiangTou\bin\Debug\SheXiangTou.dll

     文件      15872  2015-05-22 00:17  SheXiangTouTest\SheXiangTou\bin\Debug\SheXiangTou.pdb

     文件       7032  2015-05-22 22:42  SheXiangTouTest\SheXiangTou\mSheXiangTou.cs

     文件       5466  2015-07-23 22:20  SheXiangTouTest\SheXiangTou\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       3780  2015-05-22 22:36  SheXiangTouTest\SheXiangTou\obj\Debug\ResolveAssemblyReference.cache

     文件        971  2015-05-22 00:56  SheXiangTouTest\SheXiangTou\obj\Debug\SheXiangTou.csproj.FileListAbsolute.txt

     文件       8704  2015-05-22 22:44  SheXiangTouTest\SheXiangTou\obj\Debug\SheXiangTou.dll

     文件      17920  2015-05-22 22:44  SheXiangTouTest\SheXiangTou\obj\Debug\SheXiangTou.pdb

     文件       1372  2015-05-21 23:39  SheXiangTouTest\SheXiangTou\Properties\AssemblyInfo.cs

     文件      17408  2013-03-26 10:41  SheXiangTouTest\SheXiangTou\refs\AForge.dll

     文件      57856  2013-03-26 10:41  SheXiangTouTest\SheXiangTou\refs\AForge.Video.DirectShow.dll

     文件      18944  2013-03-26 10:41  SheXiangTouTest\SheXiangTou\refs\AForge.Video.dll

     文件      61952  2013-03-26 10:41  SheXiangTouTest\SheXiangTou\refs\AForge.Video.FFMPEG.dll

     文件   13496832  2013-03-26 10:41  SheXiangTouTest\SheXiangTou\refs\avcodec-53.dll

     文件     349696  2013-03-26 10:41  SheXiangTouTest\SheXiangTou\refs\avdevice-53.dll

     文件     890880  2013-03-26 10:41  SheXiangTouTest\SheXiangTou\refs\avfilter-2.dll

     文件    2462208  2013-03-26 10:41  SheXiangTouTest\SheXiangTou\refs\avformat-53.dll

     文件     137728  2013-03-26 10:41  SheXiangTouTest\SheXiangTou\refs\avutil-51.dll

     文件     296960  2013-03-26 10:41  SheXiangTouTest\SheXiangTou\refs\swscale-2.dll

     文件       2418  2015-05-22 00:56  SheXiangTouTest\SheXiangTou\SheXiangTou.csproj

     文件      17408  2013-03-26 10:41  SheXiangTouTest\SheXiangTouTest\bin\Debug\AForge.dll

     文件      57856  2013-03-26 10:41  SheXiangTouTest\SheXiangTouTest\bin\Debug\AForge.Video.DirectShow.dll

     文件      18944  2013-03-26 10:41  SheXiangTouTest\SheXiangTouTest\bin\Debug\AForge.Video.dll

     文件      61952  2013-03-26 10:41  SheXiangTouTest\SheXiangTouTest\bin\Debug\AForge.Video.FFMPEG.dll

     文件   13496832  2013-03-26 10:41  SheXiangTouTest\SheXiangTouTest\bin\Debug\avcodec-53.dll

     文件     349696  2013-03-26 10:41  SheXiangTouTest\SheXiangTouTest\bin\Debug\avdevice-53.dll

     文件     890880  2013-03-26 10:41  SheXiangTouTest\SheXiangTouTest\bin\Debug\avfilter-2.dll

     文件    2462208  2013-03-26 10:41  SheXiangTouTest\SheXiangTouTest\bin\Debug\avformat-53.dll

     文件     137728  2013-03-26 10:41  SheXiangTouTest\SheXiangTouTest\bin\Debug\avutil-51.dll

     文件       8704  2015-05-22 22:44  SheXiangTouTest\SheXiangTouTest\bin\Debug\SheXiangTou.dll

............此处省略50个文件信息

评论

共有 条评论