基本信息
源码名称:C# AForge 打开摄像头拍照
源码大小:1.23M
文件格式:.zip
开发语言:C#
更新时间:2021-06-16
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

 参考下面的教学视频做的demo

https://www.bilibili.com/video/BV1hE411M7LV?from=search&seid=10422018013517685378

视频缺少安装dll后运行一下程序,在debug下就有了dll了,工具箱添加选项卡,取个名字,然后拖拽AForge.Controls.dll到选项卡里面,这样工具箱就有videoSourcePlay控件了。


FilterInfoCollection videoDevices;
VideoCaptureDevice videoSource;


       private void StartVido_Click(object sender, EventArgs e)
       {
           this.videoSourcePlayer.SignalToStop();               //
           videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); //
           videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString); //
           this.videoSourcePlayer.VideoSource = videoSource; //
           this.videoSourcePlayer.Start();               //
       }

       private void CloseVido_Click(object sender, EventArgs e)
       {
           this.videoSourcePlayer.SignalToStop();               //
           this.videoSourcePlayer.WaitForStop();               //
       }

       private void btn_Take_Click(object sender, EventArgs e)
       {
           string imageName = DateTime.Now.ToString("yyyMMddHHmmss");
           string path = @"d:/" imageName ".jpg";
           if (videoSourcePlayer==null)
           {
               return;
           }
           //
           Bitmap bitmap = this.videoSourcePlayer.GetCurrentVideoFrame();
           bitmap.Save(path);
       }