C#引用AForge调取系统摄像头完成的驿站底单拍照系统

本文介绍了一个利用C#和AForge库开发的驿站底单拍照系统,涉及引入库、申明、基本功能实现及窗体事件处理。系统还包括面单自动拍照、底单处理、合并和水印存储功能。
摘要由CSDN通过智能技术生成

C#引用AForge调取系统摄像头来拍摄

出于驿站的出库系统需求,经过3个月的各项技术摸索,才完成了这个项目
在这里插入图片描述

总系统包括 驿站面单+人脸自动拍照,底单处理,合并,水印存储。
驿站出库API接口 被官网关闭。

二、使用步骤

1.引入库

代码如下(示例):

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using AForge;
using AForge.Video.DirectShow;

2.申明

代码如下(示例):

private bool auto;
        private FilterInfoCollection videoDevices;//驱动列表
        private VideoCaptureDevice video1;//视频资源 
        private VideoCaptureDevice video2;//视频资源 
        private jxBitmap jxBitmap = new jxBitmap();
        private jxSound jxSound = new jxSound();
        private jxTimer jxTimer = new jxTimer();
        private string path = Environment.CurrentDirectory;//当前文件路径  
        private string pathData;//存储路径
        private ini jxIni = new ini();//配置文件
        private System.Media.SoundPlayer sp = new System.Media.SoundPlayer();//音频
        private bool com2 = false;//采集通道数量 默认2
        private int sleepZxing = 600;//识别单号速度
        private int sleepLike = 3000;//启动识别之前的连接等待
        private DataTable Table = new DataTable();//数据表格
        private string dev1, dev2, devSize1, devSize2;
        private bool up,upImage;//是否上传,是否上传图片
        private string upType, upData;//上传的公司,上传的密钥
        APIkuaibao ikuaibao = new APIkuaibao();

        Thread thZ;
        //Thread thShow;
        private static ManualResetEvent _eventWorkList = new ManualResetEvent(false);

3.基本功能

代码如下(示例):

/// <summary>
        /// 获取视频输入列表
        /// </summary>
        private void getc()
        {
            //FilterInfoCollection videoDevices;
            videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
        }

        /// <summary>
        /// 连接摄像头
        /// </summary>
        private void like()
        {
            //GetAppSet();//配置文件
            videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);//列表
            int selectedDeviceIndex = 0;//驱动

            while (selectedDeviceIndex< videoDevices.Count)
            {
                if (videoDevices[selectedDeviceIndex].MonikerString == dev1)
                {
                    videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
                    video1 = new VideoCaptureDevice(videoDevices[selectedDeviceIndex].MonikerString);//连接摄像头。
                    video1.VideoResolution = video1.VideoCapabilities[int.Parse(devSize1)];
                    videoSourcePlayer1.VideoSource = video1;
                    videoSourcePlayer1.Start();
                }
       
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值