private int OnPlateResult2(int handle, IntPtr pUserData, IntPtr pResult, uint uNumPlates, VzClientSDK.VZ_LPRC_RESULT_TYPE eResultType, IntPtr pImgFull, IntPtr pImgPlateClip) { if (eResultType != VzClientSDK.VZ_LPRC_RESULT_TYPE.VZ_LPRC_RESULT_REALTIME) { VzClientSDK.TH_PlateResult result = (VzClientSDK.TH_PlateResult)Marshal.PtrToStructure(pResult, typeof(VzClientSDK.TH_PlateResult)); string strLicense = new string(result.license); //strLicense = strLicense.Replace(" ", ""); //label_out_chepai.Text = strLicense; //strLicense = label_out_chepai.Text.Trim(); if (Manager.instance.m_oldOutChepai == strLicense || strLicense.Contains(Manager.instance.m_oldOutChepai)) { Manager.instance.m_outChepaiChange = false; return(0); } else { Manager.instance.m_outChepaiChange = true; } Log.myLog.Info(string.Format("chepai='{0}'", strLicense)); Log.myLog.Info("=======>strLicense: " + strLicense); Log.myLog.Info("=======>m_oldOutChepai: " + Manager.instance.m_oldOutChepai); VzClientSDK.VZ_LPR_MSG_PLATE_INFO plateInfo = new VzClientSDK.VZ_LPR_MSG_PLATE_INFO(); plateInfo.plate = strLicense; DateTime now = DateTime.Now; string sTime = string.Format("{0:yyyyMMddHHmmssffff}", now); string strFilePath = m_sAppPath + "\\cap_out\\"; if (!Directory.Exists(strFilePath)) { Directory.CreateDirectory(strFilePath); } string path = strFilePath + sTime + ".jpg"; VzClientSDK.VzLPRClient_ImageSaveToJpeg(pImgFull, path, 100); //识别结果显示出来 // label_out_chepai.Text = strLicense; //pictureBox_out_img.Image = Image.FromFile(path); UpdateOutChepai(strLicense); UpdateOutChepaiImage(path); Manager.instance.ledControl.OutLEDTextUpdate(strLicense, "进行中..."); } return(0); }
//车牌识别结果回调 private int OnPlateResult(int handle, IntPtr pUserData, IntPtr pResult, uint uNumPlates, VzClientSDK.VZ_LPRC_RESULT_TYPE eResultType, IntPtr pImgFull, IntPtr pImgPlateClip) { if (eResultType != VzClientSDK.VZ_LPRC_RESULT_TYPE.VZ_LPRC_RESULT_REALTIME) { VzClientSDK.TH_PlateResult result = (VzClientSDK.TH_PlateResult)Marshal.PtrToStructure(pResult, typeof(VzClientSDK.TH_PlateResult)); string strLicense = new string(result.license); VzClientSDK.VZ_LPR_MSG_PLATE_INFO plateInfo = new VzClientSDK.VZ_LPR_MSG_PLATE_INFO(); plateInfo.plate = strLicense; //设置视频截图保存图片的目录及格式 DateTime nowTime = DateTime.Now; string sTime = string.Format("{0:yyyyMMddHHmmssffff}", nowTime); string strFilePath = m_sAppPath + "\\cap\\"; if (!Directory.Exists(strFilePath)) { Directory.CreateDirectory(strFilePath); } string path = strFilePath + sTime + ".jpg"; //将图像保存为JPEG到指定路径 VzClientSDK.VzLPRClient_ImageSaveToJpeg(pImgFull, path, 100); plateInfo.img_path = path; int size = Marshal.SizeOf(plateInfo); IntPtr intptr = Marshal.AllocHGlobal(size); Marshal.StructureToPtr(plateInfo, intptr, true); Win32API.PostMessage(hwndMain, MSG_PLATE_INFO, (int)intptr, handle);//将消息推送给窗体 } return(0); }