智能化设备开发 车牌识别硬件的系统集成测试(代码)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/upi2u/article/details/80706037

如今,使用图像识别技术已经是很普遍了,甚至现在用的人脸识别系统也是越来越多。平常我们接触最多的就是车牌识别系统了,停车场、小区大门管理都用上了车牌识别,车来了可以自动在系统中进行比对,符合条件的自动抬杆放行,减少人为干预也减少了很多麻烦和口舌。

这里我们要把测个系统引入到厂门放行中,在系统中刷卡写入数据后自动在ERP系统中写入对应的车辆白名单,车辆即可入场。按照厂家提供的接口文件,实现直接传递车牌参数即可写入白名单的效果。

需要说明的是:白名单数据是需要写入到摄像头硬件中的,并且写入时需要摄像头连接在局域网内。虽然写入后可以脱机使用,但是在这个场景中并不允许脱机使用。


当完成厂内业务后,再在系统白名单中将数据删除,即实现了白名单的实时应用。

车牌识别白名单添加方法:

        /// <summary>
        /// 增加车辆白名单
        /// </summary>
        /// <param name="CarPlate">车牌号</param>
        public string AddCarWhiteList( string CarPlate )
        {
            string returnMsg = "";

            byte[] chBuf;
            bool bResult = false;
            int nID = 0;

            WTY.WTYSDK_WhiteList.WTYSDK_WLIST_VEHICLE newPlateInfo = new WTY.WTYSDK_WhiteList.WTYSDK_WLIST_VEHICLE();

            if (CarPlate.Length > 16 || CarPlate.Length <= 0)
            {
                returnMsg ="车牌号码格式不正确";
            }
            
            //车牌号码
            newPlateInfo.strPlateID = new byte[16];
            chBuf = Encoding.GetEncoding("GB2312").GetBytes(CarPlate);
            Array.Copy(chBuf, newPlateInfo.strPlateID, chBuf.Length);

            //用户ID
            bResult = int.TryParse(2.ToString(), out nID);                  //用户id 提前写入 固定
            
            newPlateInfo.uCustomerID = (uint)nID;

            //车辆编码
            newPlateInfo.strCode = new byte[20];
            chBuf = Encoding.GetEncoding("GB2312").GetBytes(this.PlateCodeInCar.Text);
            Array.Copy(chBuf, newPlateInfo.strCode, chBuf.Length);

            //车辆备注
            newPlateInfo.strRemark = new byte[100];
            chBuf = Encoding.GetEncoding("GB2312").GetBytes(this.PlateRemarkInCar.Text);
            Array.Copy(chBuf, newPlateInfo.strRemark, chBuf.Length);


            newPlateInfo.bEnable = 1;

	    newPlateInfo.bUsingTimeSeg = 0;
         
            //是否黑名单
            newPlateInfo.iBlackList = 0;

            //创建时间
            newPlateInfo.struTMCreate = new byte[20];
            chBuf = Encoding.GetEncoding("GB2312").GetBytes(DateTime.Now.ToString("yyyy/MM/dd") + " " + DateTime.Now.ToString("HH:mm:ss"));
            Array.Copy(chBuf, newPlateInfo.struTMCreate, chBuf.Length);

            //生效时间
            newPlateInfo.struTMEnable = new byte[20];
            chBuf = Encoding.GetEncoding("GB2312").GetBytes(DateTime.Now.ToString("yyyy/MM/dd") + " " + DateTime.Now.ToString("HH:mm:ss"));
            Array.Copy(chBuf, newPlateInfo.struTMEnable, chBuf.Length);

            //过期时间
            newPlateInfo.struTMOverdule = new byte[20];
            chBuf = Encoding.GetEncoding("GB2312").GetBytes(DateTime.Now.AddDays(1).ToString("yyyy/MM/dd") + " " + DateTime.Now.ToString("HH:mm:ss"));
            Array.Copy(chBuf, newPlateInfo.struTMOverdule, chBuf.Length);

            //车牌颜色和车辆类型
            newPlateInfo.iColor = 1;
            newPlateInfo.iPlateType = 1;

             //添加车辆           
             nID = WTY.WTYSDK_WhiteList.WTY_WhiteListInsertVehicle(pServerIP, newPlateInfo);
             if (nID == 0)
             {
                    returnMsg = "SUCCESS";                   
             }
             else
             {
                    returnMsg = "添加车辆失败,ret = " + nID.ToString();                    
             }
            
            
            return returnMsg;
        }


猜你喜欢

转载自blog.csdn.net/upi2u/article/details/80706037