public bool DoInspect(IParameter parameter, ref IInspectedResult inspectedResult) { if (parameter.SpecMap["Bond"] is BondSpec spec) { inspectedResult.Description += String.Format("본드 이진화 값:{0} ", spec.BinarizationThreshold); } IResultObject resultObject = _container.Resolve <IResultObject>(); resultObject.ResultType = ResultType.Ng; resultObject.Description = "본드 모르는 불량."; resultObject.GrabImageMap = new Dictionary <string, IGrabImage>() { { "Bond", parameter.GrabImageMap["Bond"] } }; resultObject.ShapeMap = new Dictionary <string, EditableShape>() { { "Bond", parameter.EditableShapesMap["Bond"].First() } }; inspectedResult.ResultObjectMap.Add("Bond", resultObject); foreach (var shape in parameter.EditableShapesMap["Bond"]) { IRoundingRect rect = shape as IRoundingRect; } return(true); }
public bool?OpenResultWindow(IInspectedResult inspectedResult) { var resultWindowviewModel = _container.Resolve <IResultWindowViewModel>(UnityNameTool.ConvertViewModelName(Constant.RESULT_WINDOW)); resultWindowviewModel.InspectedResult = inspectedResult; bool?result = OpenWindowEvent(this, UnityNameTool.ConvertViewName(Constant.RESULT_WINDOW), resultWindowviewModel); return(result); }
public void DoInspect() { if (CurrentRecipe == null) { return; } int id = 0; //아이디에 따른 검사 반복이 필요. 추후 수정 필요. IParameter parameter = CreateParameter(id); parameter.Id = DateTime.Now.ToString(); IInspectedResult inspectedResult = _container.Resolve <IInspectedResult>(); inspectedResult.Id = parameter.Id; inspectedResult.ResultType = ResultType.Ng; foreach (string name in Properties.Settings.Default.AlgorithmNames) { IAlgorithm algorithm = _container.Resolve <IAlgorithm>(name); if (algorithm.DoInspect(parameter, ref inspectedResult) == false) { break; } } IMessageInfo messageInfo = _container.Resolve <IMessageInfo>(); messageInfo.Level = 1; messageInfo.Category = "검사"; messageInfo.Description = inspectedResult.Description; App.Locator.MessageViewModel.MessageInfoList.Add(messageInfo); OpenResultWindow(inspectedResult); string filePath = String.Format(@"{0}\Result\{1}.json", FolderTool.WorkingFolderFullPath, DateTime.Now.ToString("yyyyMMdd-HHmmss")); JsonTool <IInspectedResult> .Export(filePath, inspectedResult); }
public bool DoInspect(IParameter parameter, ref IInspectedResult inspectedResult) { if (parameter.SpecMap["Align"] is AlignSpec spec) { inspectedResult.Description += String.Format("정렬 이진화 값:{0} ", spec.BinarizationThreshold); } MilImage milImage = new MilImage(); milImage.Alloc(MBandSize.Gray, 3776, 2684); milImage.Load(@"D:\HVModel\NANOS\00_0.bmp"); Stopwatch watch = new Stopwatch(); watch.Start(); //for (int i = 0; i < 1000; i++) //{ // MilFilter.Median(milImage, milImage, 0, 0); //} List <MilImage> imageList = new List <MilImage>(); for (int i = 0; i < 500; i++) { MilImage newImage = new MilImage(); newImage.Alloc(MBandSize.Gray, 3776, 2684); newImage.CopyFrom(milImage, true); imageList.Add(newImage); } watch.Stop(); IMessageInfo messageInfo = _container.Resolve <IMessageInfo>(); messageInfo.Level = 1; messageInfo.Category = "측정"; messageInfo.Description = String.Format("{0} ms", watch.ElapsedMilliseconds); App.Locator.MessageViewModel.MessageInfoList.Add(messageInfo); IResultObject resultObject = _container.Resolve <IResultObject>(); resultObject.ResultType = ResultType.Ok; resultObject.Description = "정렬 정상."; resultObject.GrabImageMap = new Dictionary <string, IGrabImage>() { { "Align", parameter.GrabImageMap["Align"] } }; resultObject.ShapeMap = new Dictionary <string, EditableShape>() { { "Align", parameter.EditableShapesMap["Align"].First() } }; inspectedResult.ResultObjectMap.Add("Align", resultObject); foreach (var shape in parameter.EditableShapesMap["Align"]) { IRoundingRect rect = shape as IRoundingRect; } return(true); }