private List<SpotInspectionUnit> GetErrPointList(CompletedDetectOneScanBdEventArgs e) { Dictionary<System.Drawing.Point, int> redACount; Dictionary<System.Drawing.Point, int> greenCount; Dictionary<System.Drawing.Point, int> blueCount; Dictionary<System.Drawing.Point, int> redBCount; Dictionary<System.Drawing.Point, int> allErrCount; GetErrPointInfo(e, out redACount, out greenCount, out blueCount, out redBCount, out allErrCount); List<SpotInspectionUnit> spotInspectionUnitList = new List<SpotInspectionUnit>(); SpotInspectionUnit unit; int pointOfModule = e.ScanBdProp.StandardLedModuleProp.ModulePixelRows * e.ScanBdProp.StandardLedModuleProp.ModulePixelCols * (e.ErrorPointInfo.IsSupportRedB ? 4 : 3); foreach (var item in allErrCount) { unit = new SpotInspectionUnit(); unit.UnitTotalPoint = pointOfModule; unit.AllErrorPointNumner = item.Value; if (redACount.ContainsKey(item.Key)) unit.RedPointErrorNumber = redACount[item.Key]; if (greenCount.ContainsKey(item.Key)) unit.GreenPointErrorNumber = greenCount[item.Key]; if (blueCount.ContainsKey(item.Key)) unit.BluePointErrorNumber = blueCount[item.Key]; if (e.ErrorPointInfo.IsSupportRedB) { if (redBCount.ContainsKey(item.Key)) unit.VirtualRedPointErrorNumber = redBCount[item.Key]; } spotInspectionUnitList.Add(unit); } return spotInspectionUnitList; }
private void detectPointPerformer_CompletedDetectOneScanBdEvent(object sender, CompletedDetectOneScanBdEventArgs e) { DetectPointPerformer performer = sender as DetectPointPerformer; string sn = performer.Id; # if test _spotInspectionReusltTable[sn].Result = true; _spotInspectionReusltTable[sn].IsSupportVirtualRed = false; SpotInspectionBox spotInspectionBox = new SpotInspectionBox() { BoxTotalPoint = e.ScanBdInfo.Width * e.ScanBdInfo.Height * 3, Position = e.ScanBdInfo.SenderIndex + "-" + e.ScanBdInfo.PortIndex + "-" + e.ScanBdInfo.ConnectIndex, SpotInspectionUnitList = new List<SpotInspectionUnit>()// GetErrPointList(e) }; _spotInspectionReusltTable[sn].TotalPoint += spotInspectionBox.BoxTotalPoint; _spotInspectionReusltTable[sn].UnitCount += (e.ScanBdProp.Width / e.ScanBdProp.StandardLedModuleProp.ModulePixelCols) * (e.ScanBdProp.Height / e.ScanBdProp.StandardLedModuleProp.ModulePixelRows); if (spotInspectionBox.SpotInspectionUnitList.Count != 0 && _spotInspectionReusltTable[sn].SpotInspectionBoxList.FindIndex(a => a.Position == spotInspectionBox.Position) < 0) _spotInspectionReusltTable[sn].SpotInspectionBoxList.Add(spotInspectionBox); #else if (e.IsDetectedSuccessful) { _spotInspectionReusltTable[sn].IsSupportVirtualRed = e.ErrorPointInfo.IsSupportRedB; SpotInspectionBox spotInspectionBox = new SpotInspectionBox() { BoxTotalPoint = e.ErrorPointInfo.IsSupportRedB ? e.ScanBdInfo.Width * e.ScanBdInfo.Height * 4 : e.ScanBdInfo.Width * e.ScanBdInfo.Height * 3, Position = e.ScanBdInfo.SenderIndex + "-" + e.ScanBdInfo.PortIndex + "-" + e.ScanBdInfo.ConnectIndex, SpotInspectionUnitList = GetErrPointList(e) }; _spotInspectionReusltTable[sn].TotalPoint += spotInspectionBox.BoxTotalPoint; _spotInspectionReusltTable[sn].UnitCount += (e.ScanBdProp.Width / e.ScanBdProp.StandardLedModuleProp.ModulePixelCols) * (e.ScanBdProp.Height / e.ScanBdProp.StandardLedModuleProp.ModulePixelRows); if (spotInspectionBox.SpotInspectionUnitList.Count != 0 && _spotInspectionReusltTable[sn].SpotInspectionBoxList.FindIndex(a => a.Position == spotInspectionBox.Position) < 0) _spotInspectionReusltTable[sn].SpotInspectionBoxList.Add(spotInspectionBox); } else _spotInspectionReusltTable[sn].Result = false; #endif }
private void GetErrPointInfo(CompletedDetectOneScanBdEventArgs e, out Dictionary<System.Drawing.Point, int> redACount, out Dictionary<System.Drawing.Point, int> greenCount, out Dictionary<System.Drawing.Point, int> blueCount, out Dictionary<System.Drawing.Point, int> redBCount, out Dictionary<System.Drawing.Point, int> allErrCount) { redACount = new Dictionary<System.Drawing.Point, int>(); greenCount = new Dictionary<System.Drawing.Point, int>(); blueCount = new Dictionary<System.Drawing.Point, int>(); redBCount = new Dictionary<System.Drawing.Point, int>(); allErrCount = new Dictionary<System.Drawing.Point, int>(); if (e.ErrorPointInfo == null) { return; } int width = e.ScanBdProp.StandardLedModuleProp.ModulePixelCols, height = e.ScanBdProp.StandardLedModuleProp.ModulePixelRows; System.Drawing.Point p; if (e.ErrorPointInfo.ErrorRedAPointList != null) { foreach (var item in e.ErrorPointInfo.ErrorRedAPointList) { p = new System.Drawing.Point(item.X / width, item.Y / height); if (redACount.ContainsKey(p)) { redACount[p] += 1; } else redACount.Add(p, 1); if (allErrCount.ContainsKey(p)) { allErrCount[p] += 1; } else allErrCount.Add(p, 1); } } if (e.ErrorPointInfo.ErrorGreenPointList != null) { foreach (var item in e.ErrorPointInfo.ErrorGreenPointList) { p = new System.Drawing.Point(item.X / width, item.Y / height); if (greenCount.ContainsKey(p)) { greenCount[p] += 1; } else greenCount.Add(p, 1); if (allErrCount.ContainsKey(p)) { allErrCount[p] += 1; } else allErrCount.Add(p, 1); } } if (e.ErrorPointInfo.ErrorBluePointList != null) { foreach (var item in e.ErrorPointInfo.ErrorBluePointList) { p = new System.Drawing.Point(item.X / width, item.Y / height); if (blueCount.ContainsKey(p)) { blueCount[p] += 1; } else blueCount.Add(p, 1); if (allErrCount.ContainsKey(p)) { allErrCount[p] += 1; } else allErrCount.Add(p, 1); } } if (e.ErrorPointInfo.IsSupportRedB) { foreach (var item in e.ErrorPointInfo.ErrorRedBPointList) { p = new System.Drawing.Point(item.X / width, item.Y / height); if (redBCount.ContainsKey(p)) { redBCount[p] += 1; } else redBCount.Add(p, 1); if (allErrCount.ContainsKey(p)) { allErrCount[p] += 1; } else allErrCount.Add(p, 1); } } }