| @@ -1,6 +1,7 @@ | |||||
| using HalconDotNet; | using HalconDotNet; | ||||
| using MaiMuAOI.SysCtrl; | using MaiMuAOI.SysCtrl; | ||||
| using MaiMuControl.Device; | using MaiMuControl.Device; | ||||
| using MaiMuControl.Device.CamDev; | |||||
| using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
| using Newtonsoft.Json.Linq; | using Newtonsoft.Json.Linq; | ||||
| using OpenCvSharp; | using OpenCvSharp; | ||||
| @@ -265,6 +266,30 @@ namespace MaiMuAOI.ImageProcessing | |||||
| task.offsetY = (double)ProcCall1_PI_PT.GetOutputCtrlParamTuple("offsetY"); | task.offsetY = (double)ProcCall1_PI_PT.GetOutputCtrlParamTuple("offsetY"); | ||||
| break; | break; | ||||
| } | } | ||||
| step = 5; | |||||
| //尺寸标注 | |||||
| if (task.index != 3333) | |||||
| { | |||||
| try | |||||
| { | |||||
| step = 6; | |||||
| var posePT = ProcCall1_PI_PT.GetOutputCtrlParamTuple("posePT").DArr; | |||||
| step = 7; | |||||
| //Yolo_Class yolo = new Yolo_Class(); | |||||
| step = 8; | |||||
| var mat = CamDev.HImageToMat(image); | |||||
| step = 9; | |||||
| //task.SaveMat = yolo.DisplayLines(mat, posePT, task.index).Clone(); | |||||
| task.SaveMat = yolo5.DisplayLines(mat, posePT, task.index); | |||||
| } | |||||
| catch (Exception ex) | |||||
| { | |||||
| //WarningEvent?.Invoke(WarningEnum.Low, $"SizeLib task err({step}) index({task.index}):" + ex.Message); | |||||
| task.SaveMat = null; | |||||
| } | |||||
| } | |||||
| step = 100; | step = 100; | ||||
| ProcCall1_PI_PT.Dispose(); | ProcCall1_PI_PT.Dispose(); | ||||
| Program1.Dispose(); | Program1.Dispose(); | ||||
| @@ -343,6 +368,8 @@ namespace MaiMuAOI.ImageProcessing | |||||
| public double PT1,PT2, Shanxian, Circle_Ymm, Circle_Xmm, offsetX, offsetY; | public double PT1,PT2, Shanxian, Circle_Ymm, Circle_Xmm, offsetX, offsetY; | ||||
| public bool isSucceed;//转换是否成功 | public bool isSucceed;//转换是否成功 | ||||
| public string resultInfo = "";//成功或失败信息 | public string resultInfo = "";//成功或失败信息 | ||||
| public Mat SaveMat; | |||||
| } | } | ||||
| public void add(SizeTask task) | public void add(SizeTask task) | ||||
| @@ -7237,7 +7237,11 @@ namespace MaiMuAOI.SysCtrl | |||||
| res.Himage.Dispose(); | res.Himage.Dispose(); | ||||
| res.Himage = null; | res.Himage = null; | ||||
| } | } | ||||
| if (res.SaveMat != null) | |||||
| { | |||||
| res.SaveMat.Dispose(); | |||||
| res.SaveMat = null; | |||||
| } | |||||
| } | } | ||||
| }); | }); | ||||
| @@ -8163,6 +8167,15 @@ namespace MaiMuAOI.SysCtrl | |||||
| HOperatorSet.WriteImage(res.Himage, "bmp", 0, path); | HOperatorSet.WriteImage(res.Himage, "bmp", 0, path); | ||||
| else | else | ||||
| API.CopyFile(res.file_path, path, false);//比.NET(File.Copy)更快 | API.CopyFile(res.file_path, path, false);//比.NET(File.Copy)更快 | ||||
| lock (ImageSaveObj) | |||||
| { | |||||
| path = Util.CreateSubDir(confMgr.SysConfigParams.SizeBigImag.SavePath, new List<string> { order.CreateTime.ToString("yyyyMMdd"), order.SN }); | |||||
| path += $"Size_SN{order.SN}_I{res.index}_X{res.posX}_Y{res.posY}_{model.StepInfo.Name}"; | |||||
| if (res.SaveMat != null) | |||||
| res.SaveMat.ImWrite(path + "_DB.bmp"); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| catch (Exception ex) | catch (Exception ex) | ||||
| @@ -8180,6 +8193,12 @@ namespace MaiMuAOI.SysCtrl | |||||
| { | { | ||||
| API.DeleteFile(res.file_path); | API.DeleteFile(res.file_path); | ||||
| } | } | ||||
| if (res.SaveMat != null) | |||||
| { | |||||
| res.SaveMat.Dispose(); | |||||
| res.SaveMat = null; | |||||
| } | |||||
| } | } | ||||
| }); | }); | ||||
| @@ -8332,6 +8351,11 @@ namespace MaiMuAOI.SysCtrl | |||||
| { | { | ||||
| API.DeleteFile(res.file_path); | API.DeleteFile(res.file_path); | ||||
| } | } | ||||
| if (res.SaveMat != null) | |||||
| { | |||||
| res.SaveMat.Dispose(); | |||||
| res.SaveMat = null; | |||||
| } | |||||
| } | } | ||||
| }); | }); | ||||
| compBmpNum++; | compBmpNum++; | ||||
| @@ -67,6 +67,7 @@ namespace MaiMuAOI.SysCtrl | |||||
| "\t9.修复缺陷分布功能关闭状态下缺陷处理报错\r\n" + | "\t9.修复缺陷分布功能关闭状态下缺陷处理报错\r\n" + | ||||
| "\t10.修复流程配置关闭,流程调试不关闭bug\r\n" + | "\t10.修复流程配置关闭,流程调试不关闭bug\r\n" + | ||||
| "\t11.修复数据查询中把均值多加一列\r\n" + | "\t11.修复数据查询中把均值多加一列\r\n" + | ||||
| "\t12.导出excel的格式csv改为xlsx\r\n"; | |||||
| "\t12.导出excel的格式csv改为xlsx\r\n" + | |||||
| "\t13.优化张力读取,尺寸检测保存图加入标注\r\n"; | |||||
| } | } | ||||
| } | } | ||||