public double GetHistogramStandardDeviatioValue(CogImage8Grey _SrcImage, CogRectangle _InspRegion) { CogHistogramTool _CogHistoTool = new CogHistogramTool(); _CogHistoTool.InputImage = _SrcImage; _CogHistoTool.Region = _InspRegion; _CogHistoTool.Run(); double _HistoDeviation = _CogHistoTool.Result.StandardDeviation; return(_HistoDeviation); }
public void Run(ADisplay display) { SetHistParam(); if (m_cogHistogramTool != null) { m_cogHistogramTool.InputImage = display.GetImage8Grey(); if (m_icogImgMask != null) { m_cogHistogramTool.RunParams.InputImageMask = m_icogImgMask; } try { // 2015.04.08 m_bRan = false; m_cogHistogramTool.Run(); // 2015.04.08 WaitRanEvent(); if (m_cogHistogramTool.Result != null) { m_nWGVThreshold = m_cogHistogramTool.Result.GetMinimumWGVThreshold(); m_nMinValue = m_cogHistogramTool.Result.Minimum; m_nMaxValue = m_cogHistogramTool.Result.Maximum; m_dMean = m_cogHistogramTool.Result.Mean; m_nMode = m_cogHistogramTool.Result.Mode; m_nMedian = m_cogHistogramTool.Result.Median; m_nSampleCount = m_cogHistogramTool.Result.NumSamples; // 2014.06.12 m_dStandardDeviation = m_cogHistogramTool.Result.StandardDeviation; m_isRun = true; } } catch { MessageBox.Show("Run Histogram Error"); m_isRun = false; } } }
public double GetHistogramStandardDeviatioValue(CogImage8Grey _SrcImage, CogRectangle _InspRegion) { //Image ADD CogIPTwoImageAddTool _CogImageAddTool = new CogIPTwoImageAddTool(); _CogImageAddTool.InputImageA = _SrcImage; _CogImageAddTool.InputImageB = _SrcImage; _CogImageAddTool.Run(); CogImage8Grey _DestImage = (CogImage8Grey)_CogImageAddTool.OutputImage; CogHistogramTool _CogHistoTool = new CogHistogramTool(); //_CogHistoTool.InputImage = _SrcImage; _CogHistoTool.InputImage = _DestImage; _CogHistoTool.Region = _InspRegion; _CogHistoTool.Run(); double _HistoDeviation = _CogHistoTool.Result.StandardDeviation; return(_HistoDeviation); }
public bool Run(CogImage8Grey _SrcImage, CogRectangle _InspRegion, CogEllipseAlgo _CogEllipseAlgo, ref CogEllipseResult _CogEllipseResult, double _OffsetX = 0, double _OffsetY = 0, int _NgNumber = 0) { bool _Result = true; #region Caliper Center XY 구하기 -> Blob으로 Center 위치 Search #region GetAutoThresholdValue CogHistogramTool _HistoTool = new CogHistogramTool(); _HistoTool.InputImage = _SrcImage; _HistoTool.Region = _InspRegion; _HistoTool.Run(); int[] _HistoValue = _HistoTool.Result.GetHistogram(); double _TotSize = _InspRegion.Width * _InspRegion.Height; double _ThresholdSum = 0; int _ThresholdValue = 0; for (int iLoopCount = 0; iLoopCount < 256; ++iLoopCount) { _ThresholdSum += iLoopCount * _HistoValue[iLoopCount]; } double _ThresholdSum2 = 0; double _WeightBack = 0, _WeightFore = 0, _VarMax = 0; for (int iLoopCount = 0; iLoopCount < 256; ++iLoopCount) { _WeightBack += _HistoValue[iLoopCount]; if (0 == _WeightBack) { continue; } _WeightFore = _TotSize - _WeightBack; if (0 == _WeightFore) { break; } _ThresholdSum2 += (double)(iLoopCount * _HistoValue[iLoopCount]); double _MeanBack = _ThresholdSum2 / _WeightBack; double _MeanFore = (_ThresholdSum - _ThresholdSum2) / _WeightFore; double _VarBetween = _WeightBack * _WeightFore * Math.Pow((_MeanBack - _MeanFore), 2); if (_VarBetween > _VarMax) { _VarMax = _VarBetween; _ThresholdValue = iLoopCount; } } #endregion #region Blob Search CogBlobTool _BlobTool = new CogBlobTool(); _BlobTool.InputImage = _SrcImage; _BlobTool.Region = _InspRegion; _BlobTool.RunParams.SegmentationParams.Mode = CogBlobSegmentationModeConstants.HardFixedThreshold; _BlobTool.RunParams.SegmentationParams.Polarity = CogBlobSegmentationPolarityConstants.LightBlobs; _BlobTool.RunParams.ConnectivityMode = CogBlobConnectivityModeConstants.GreyScale; _BlobTool.RunParams.ConnectivityCleanup = CogBlobConnectivityCleanupConstants.Fill; _BlobTool.RunParams.SegmentationParams.HardFixedThreshold = _ThresholdValue; _BlobTool.RunParams.ConnectivityMinPixels = 10000; _BlobTool.Run(); CogBlobResults _BlobResults = _BlobTool.Results; double _MaxSize = 0; double _CaliperCenterX = 0; double _CaliperCenterY = 0; if (_BlobResults.GetBlobs().Count > 0) { for (int iLoopCount = 0; iLoopCount < _BlobResults.GetBlobs().Count; ++iLoopCount) { CogBlobResult _BlobResult = _BlobResults.GetBlobByID(iLoopCount); if (_BlobResult.Area > _MaxSize) { _MaxSize = _BlobResult.Area; _CaliperCenterX = _BlobResult.CenterOfMassX; _CaliperCenterY = _BlobResult.CenterOfMassY; } } } else { _CaliperCenterX = _CogEllipseAlgo.ArcCenterX - _OffsetX; _CaliperCenterY = _CogEllipseAlgo.ArcCenterY - _OffsetY; } //CogSerializer.SaveObjectToFile(_BlobTool, string.Format(@"D:\CircleBlob.vpp")); #endregion #endregion SetCaliperDirection(_CogEllipseAlgo.CaliperSearchDirection, _CogEllipseAlgo.CaliperPolarity); SetCaliper(_CogEllipseAlgo.CaliperNumber, _CogEllipseAlgo.CaliperSearchLength, _CogEllipseAlgo.CaliperProjectionLength, _CogEllipseAlgo.CaliperIgnoreNumber); //LJH 2019.05.23 Caliper Center 기준점 변경 //SetEllipticalArc(_CogEllipseAlgo.ArcCenterX - _OffsetX, _CogEllipseAlgo.ArcCenterY - _OffsetY, _CogEllipseAlgo.ArcRadiusX, _CogEllipseAlgo.ArcRadiusY, _CogEllipseAlgo.ArcAngleSpan); SetEllipticalArc(_CaliperCenterX, _CaliperCenterY, _CogEllipseAlgo.ArcRadiusX, _CogEllipseAlgo.ArcRadiusY, _CogEllipseAlgo.ArcAngleSpan); if (true == Inspection(_SrcImage)) { GetResult(); } if (FindEllipseResults != null && FindEllipseResults.Count > 0) { _CogEllipseResult.IsGood = true; } else { _CogEllipseResult.IsGood = false; } if (!_CogEllipseResult.IsGood) { CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - Ellipse Find Fail!!", CLogManager.LOG_LEVEL.MID); _CogEllipseResult.CenterX = _CogEllipseAlgo.ArcCenterX; _CogEllipseResult.CenterY = _CogEllipseAlgo.ArcCenterY; _CogEllipseResult.RadiusX = _CogEllipseAlgo.ArcRadiusX; _CogEllipseResult.RadiusY = _CogEllipseAlgo.ArcRadiusY; _CogEllipseResult.OriginX = 0; _CogEllipseResult.OriginY = 0; _CogEllipseResult.Rotation = 0; _CogEllipseResult.NgNumber = _NgNumber; } else { if (FindEllipseResults.GetEllipse() != null) { CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - Ellipse Complete", CLogManager.LOG_LEVEL.MID); _CogEllipseResult.PointFoundCount = FindEllipseResults.NumPointsFound; _CogEllipseResult.CenterX = FindEllipseResults.GetEllipse().CenterX; _CogEllipseResult.CenterY = FindEllipseResults.GetEllipse().CenterY; _CogEllipseResult.RadiusX = FindEllipseResults.GetEllipse().RadiusX; _CogEllipseResult.RadiusY = FindEllipseResults.GetEllipse().RadiusY; _CogEllipseResult.OriginX = FindEllipseResults.GetEllipse().CenterX; _CogEllipseResult.OriginY = FindEllipseResults.GetEllipse().CenterY; _CogEllipseResult.Rotation = FindEllipseResults.GetEllipse().Rotation; _CogEllipseResult.NgNumber = _NgNumber; _CogEllipseResult.PointPosXInfo = new double[FindEllipseResults.Count]; _CogEllipseResult.PointPosYInfo = new double[FindEllipseResults.Count]; _CogEllipseResult.PointStatusInfo = new bool[FindEllipseResults.Count]; for (int iLoopCount = 0; iLoopCount < FindEllipseResults.Count; ++iLoopCount) { if (true == FindEllipseResults[iLoopCount].Found) { _CogEllipseResult.PointPosXInfo[iLoopCount] = FindEllipseResults[iLoopCount].X; _CogEllipseResult.PointPosYInfo[iLoopCount] = FindEllipseResults[iLoopCount].Y; } _CogEllipseResult.PointStatusInfo[iLoopCount] = FindEllipseResults[iLoopCount].Used; } _CogEllipseResult.DiameterMinAlgo = _CogEllipseAlgo.DiameterSize - _CogEllipseAlgo.DiameterMinus; _CogEllipseResult.DiameterMaxAlgo = _CogEllipseAlgo.DiameterSize + _CogEllipseAlgo.DiameterPlus; CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format(" - Center X : {0}, Y : {1}", _CogEllipseResult.CenterX.ToString("F2"), _CogEllipseResult.CenterY.ToString("F2")), CLogManager.LOG_LEVEL.MID); CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format(" - Radius X : {0}, Y : {1}", _CogEllipseResult.RadiusX.ToString("F2"), _CogEllipseResult.RadiusY.ToString("F2")), CLogManager.LOG_LEVEL.MID); } else { CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - Ellipse Find Fail!!", CLogManager.LOG_LEVEL.MID); _CogEllipseResult.CenterX = _CogEllipseAlgo.ArcCenterX; _CogEllipseResult.CenterY = _CogEllipseAlgo.ArcCenterY; _CogEllipseResult.RadiusX = _CogEllipseAlgo.ArcRadiusX; _CogEllipseResult.RadiusY = _CogEllipseAlgo.ArcRadiusY; _CogEllipseResult.OriginX = 0; _CogEllipseResult.OriginY = 0; _CogEllipseResult.NgNumber = _NgNumber; _CogEllipseResult.IsGood = false; } } CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - Result : " + _CogEllipseResult.IsGood.ToString(), CLogManager.LOG_LEVEL.MID); return(_Result); }
public bool Run(CogImage8Grey _SrcImage, CogRectangleAffine _InspRegion, CogBlobReferenceAlgo _CogBlobReferAlgo, ref CogBlobReferenceResult _CogBlobReferResult, int _NgNumber = 0) { bool _Result = true; double _X = 0, _Y = 0; SetHardFixedThreshold(_CogBlobReferAlgo.ThresholdMin); SetConnectivityMinimum((int)_CogBlobReferAlgo.BlobAreaMin); SetPolarity(Convert.ToBoolean(_CogBlobReferAlgo.ForeGround)); SetMeasurement(CogBlobMeasureConstants.Area, CogBlobMeasureModeConstants.Filter, CogBlobFilterModeConstants.IncludeBlobsInRange, _CogBlobReferAlgo.BlobAreaMin, _CogBlobReferAlgo.BlobAreaMax); if (true == Inspection(_SrcImage, _InspRegion)) { GetResult(true); } List <int> _ResultIndexList = new List <int>(); if (GetResults().BlobCount > 0) { CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - Blob Total Count : " + GetResults().BlobCount.ToString(), CLogManager.LOG_LEVEL.MID); CogBlobReferenceResult _CogBlobReferResultTemp = new CogBlobReferenceResult(); _CogBlobReferResultTemp = GetResults(); double _ResolutionX = _CogBlobReferAlgo.ResolutionX; double _ResolutionY = _CogBlobReferAlgo.ResolutionY; for (int iLoopCount = 0; iLoopCount < _CogBlobReferResultTemp.BlobCount; ++iLoopCount) { double _ResultRealWidth = _CogBlobReferResultTemp.Width[iLoopCount] * _ResolutionX; double _ResultRealHeight = _CogBlobReferResultTemp.Height[iLoopCount] * _ResolutionY; if (_CogBlobReferAlgo.WidthMin < _ResultRealWidth && _CogBlobReferAlgo.WidthMax > _ResultRealWidth && _CogBlobReferAlgo.HeightMin < _ResultRealHeight && _CogBlobReferAlgo.HeightMax > _ResultRealHeight) { _CogBlobReferResultTemp.IsGoods[iLoopCount] = true; if (_CogBlobReferAlgo.UseBodyArea) { CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - UseBodyArea Flag True", CLogManager.LOG_LEVEL.MID); double _BodyAreaGap = Math.Abs(_CogBlobReferResultTemp.BlobArea[iLoopCount] - _CogBlobReferAlgo.BodyArea); if ((_CogBlobReferAlgo.BodyArea * _CogBlobReferAlgo.BodyAreaPermitPercent / 100) > _BodyAreaGap) { CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - UseBodyArea Result Fail!!", CLogManager.LOG_LEVEL.MID); CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format(" - UseBodyArea Result : {0}", _BodyAreaGap.ToString("F2")), CLogManager.LOG_LEVEL.MID); CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format(" - UseBodyArea Condition : {0}", (_CogBlobReferAlgo.BodyArea * _CogBlobReferAlgo.BodyAreaPermitPercent / 100).ToString("F2")), CLogManager.LOG_LEVEL.MID); _CogBlobReferResultTemp.IsGoods[iLoopCount] = false; continue; } } if (_CogBlobReferAlgo.UseBodyWidth) { CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - UseBodyWidth Flag True", CLogManager.LOG_LEVEL.MID); double _BodyWidthGap = Math.Abs(_CogBlobReferResultTemp.Width[iLoopCount] - _CogBlobReferAlgo.BodyWidth); if ((_CogBlobReferAlgo.BodyWidth * _CogBlobReferAlgo.BodyWidthPermitPercent / 100) > _BodyWidthGap) { CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - UseBodyWidth Result Fail!!", CLogManager.LOG_LEVEL.MID); CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format(" - UseBodyWidth Result : {0}", _BodyWidthGap.ToString("F2")), CLogManager.LOG_LEVEL.MID); CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format(" - UseBodyWidth Condition : {0}", (_CogBlobReferAlgo.BodyWidth * _CogBlobReferAlgo.BodyWidthPermitPercent / 100).ToString("F2")), CLogManager.LOG_LEVEL.MID); _CogBlobReferResultTemp.IsGoods[iLoopCount] = false; continue; } } if (_CogBlobReferAlgo.UseBodyHeight) { CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - UseBodyHeight Flag True", CLogManager.LOG_LEVEL.MID); double _BodyHeightGap = Math.Abs(_CogBlobReferResultTemp.Height[iLoopCount] - _CogBlobReferAlgo.BodyHeight); if ((_CogBlobReferAlgo.BodyHeight * _CogBlobReferAlgo.BodyHeightPermitPercent / 100) > _BodyHeightGap) { CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - UseBodyHeight Result Fail!!", CLogManager.LOG_LEVEL.MID); CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format(" - UseBodyHeight Result : {0}", _BodyHeightGap.ToString("F2")), CLogManager.LOG_LEVEL.MID); CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format(" - UseBodyHeight Condition : {0}", (_CogBlobReferAlgo.BodyHeight * _CogBlobReferAlgo.BodyHeightPermitPercent / 100).ToString("F2")), CLogManager.LOG_LEVEL.MID); _CogBlobReferResultTemp.IsGoods[iLoopCount] = false; continue; } } CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format(" - W : {0}mm, H : {1}mm", _ResultRealWidth, _ResultRealHeight), CLogManager.LOG_LEVEL.MID); eBenchMarkPosition _eBenchMark = (eBenchMarkPosition)_CogBlobReferAlgo.BenchMarkPosition; if (eBenchMarkPosition.TL == _eBenchMark) { _X = _CogBlobReferResultTemp.BlobMinX[iLoopCount]; _Y = _CogBlobReferResultTemp.BlobMinY[iLoopCount]; } else if (eBenchMarkPosition.TC == _eBenchMark) { _X = _CogBlobReferResultTemp.BlobCenterX[iLoopCount]; _Y = _CogBlobReferResultTemp.BlobMinY[iLoopCount]; } else if (eBenchMarkPosition.TR == _eBenchMark) { _X = _CogBlobReferResultTemp.BlobMaxX[iLoopCount]; _Y = _CogBlobReferResultTemp.BlobMinY[iLoopCount]; } else if (eBenchMarkPosition.ML == _eBenchMark) { _X = _CogBlobReferResultTemp.BlobMinX[iLoopCount]; _Y = _CogBlobReferResultTemp.BlobCenterY[iLoopCount]; } else if (eBenchMarkPosition.MC == _eBenchMark) { _X = _CogBlobReferResultTemp.BlobCenterX[iLoopCount]; _Y = _CogBlobReferResultTemp.BlobCenterY[iLoopCount]; } else if (eBenchMarkPosition.MR == _eBenchMark) { _X = _CogBlobReferResultTemp.BlobMaxX[iLoopCount]; _Y = _CogBlobReferResultTemp.BlobCenterY[iLoopCount]; } else if (eBenchMarkPosition.BL == _eBenchMark) { _X = _CogBlobReferResultTemp.BlobMinX[iLoopCount]; _Y = _CogBlobReferResultTemp.BlobMaxY[iLoopCount]; } else if (eBenchMarkPosition.BC == _eBenchMark) { _X = _CogBlobReferResultTemp.BlobCenterX[iLoopCount]; _Y = _CogBlobReferResultTemp.BlobMaxY[iLoopCount]; } else if (eBenchMarkPosition.BR == _eBenchMark) { _X = _CogBlobReferResultTemp.BlobMaxX[iLoopCount]; _Y = _CogBlobReferResultTemp.BlobMaxY[iLoopCount]; } _CogBlobReferResultTemp.OriginX[iLoopCount] = _X; _CogBlobReferResultTemp.OriginY[iLoopCount] = _Y; _ResultIndexList.Add(iLoopCount); } } if (_ResultIndexList.Count > 0) { if (_CogBlobReferAlgo.UseDummyValue) { //Image ADD CogIPTwoImageAddTool _CogImageAddTool = new CogIPTwoImageAddTool(); _CogImageAddTool.InputImageA = _SrcImage; _CogImageAddTool.InputImageB = _SrcImage; _CogImageAddTool.Run(); CogImage8Grey _DestImage = (CogImage8Grey)_CogImageAddTool.OutputImage; //Histogram check CogHistogramTool _CogHistoTool = new CogHistogramTool(); //_CogHistoTool.InputImage = _SrcImage; _CogHistoTool.InputImage = _DestImage; _CogHistoTool.Region = _InspRegion; _CogHistoTool.Run(); double _HistoAvg = _CogHistoTool.Result.StandardDeviation; _CogBlobReferResult.HistogramAvg = _HistoAvg; //if (_CogBlobReferAlgo.DummyHistoMeanValue + 5 > _HistoAvg)// && _CogBlobReferAlgo.DummyHistoMeanValue - 5 < _HistoAvg) if (_CogBlobReferAlgo.DummyHistoMeanValue > _HistoAvg) { _CogBlobReferResult.DummyStatus = true; } CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - Dummy Deviation : " + _HistoAvg.ToString("F2"), CLogManager.LOG_LEVEL.MID); CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - Dummy Status : " + _CogBlobReferResult.DummyStatus.ToString(), CLogManager.LOG_LEVEL.MID); } CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - Blob Condition Count : " + _ResultIndexList.Count.ToString(), CLogManager.LOG_LEVEL.MID); #region _CogBlobReferResult 할당 int _Count = _ResultIndexList.Count; _CogBlobReferResult.BlobCount = _Count; _CogBlobReferResult.BlobMessCenterX = new double[_Count]; _CogBlobReferResult.BlobMessCenterY = new double[_Count]; _CogBlobReferResult.BlobCenterX = new double[_Count]; _CogBlobReferResult.BlobCenterY = new double[_Count]; _CogBlobReferResult.BlobMinX = new double[_Count]; _CogBlobReferResult.BlobMaxX = new double[_Count]; _CogBlobReferResult.BlobMinY = new double[_Count]; _CogBlobReferResult.BlobMaxY = new double[_Count]; _CogBlobReferResult.Width = new double[_Count]; _CogBlobReferResult.Height = new double[_Count]; _CogBlobReferResult.BlobRatio = new double[_Count]; _CogBlobReferResult.Angle = new double[_Count]; _CogBlobReferResult.BlobXMinYMax = new double[_Count]; _CogBlobReferResult.BlobXMaxYMin = new double[_Count]; _CogBlobReferResult.BlobArea = new double[_Count]; _CogBlobReferResult.OriginX = new double[_Count]; _CogBlobReferResult.OriginY = new double[_Count]; _CogBlobReferResult.IsGoods = new bool[_Count]; _CogBlobReferResult.ResultGraphic = new CogCompositeShape[_Count]; #endregion _CogBlobReferResult 할당 for (int iLoopCount = 0; iLoopCount < _Count; ++iLoopCount) { _CogBlobReferResult.BlobMessCenterX[iLoopCount] = _CogBlobReferResultTemp.BlobMessCenterX[_ResultIndexList[iLoopCount]]; _CogBlobReferResult.BlobMessCenterY[iLoopCount] = _CogBlobReferResultTemp.BlobMessCenterY[_ResultIndexList[iLoopCount]]; _CogBlobReferResult.BlobCenterX[iLoopCount] = _CogBlobReferResultTemp.BlobCenterX[_ResultIndexList[iLoopCount]]; _CogBlobReferResult.BlobCenterY[iLoopCount] = _CogBlobReferResultTemp.BlobCenterY[_ResultIndexList[iLoopCount]]; _CogBlobReferResult.BlobMinX[iLoopCount] = _CogBlobReferResultTemp.BlobMinX[_ResultIndexList[iLoopCount]]; _CogBlobReferResult.BlobMaxX[iLoopCount] = _CogBlobReferResultTemp.BlobMaxX[_ResultIndexList[iLoopCount]]; _CogBlobReferResult.BlobMinY[iLoopCount] = _CogBlobReferResultTemp.BlobMinY[_ResultIndexList[iLoopCount]]; _CogBlobReferResult.BlobMaxY[iLoopCount] = _CogBlobReferResultTemp.BlobMaxY[_ResultIndexList[iLoopCount]]; _CogBlobReferResult.Width[iLoopCount] = _CogBlobReferResultTemp.Width[_ResultIndexList[iLoopCount]]; _CogBlobReferResult.Height[iLoopCount] = _CogBlobReferResultTemp.Height[_ResultIndexList[iLoopCount]]; _CogBlobReferResult.BlobArea[iLoopCount] = _CogBlobReferResultTemp.BlobArea[_ResultIndexList[iLoopCount]]; _CogBlobReferResult.OriginX[iLoopCount] = _CogBlobReferResultTemp.OriginX[_ResultIndexList[iLoopCount]]; _CogBlobReferResult.OriginY[iLoopCount] = _CogBlobReferResultTemp.OriginY[_ResultIndexList[iLoopCount]]; _CogBlobReferResult.IsGoods[iLoopCount] = _CogBlobReferResultTemp.IsGoods[_ResultIndexList[iLoopCount]]; _CogBlobReferResult.ResultGraphic[iLoopCount] = _CogBlobReferResultTemp.ResultGraphic[iLoopCount]; } _CogBlobReferResult.IsGood = true; } else { _CogBlobReferResult.BlobMinX = new double[1]; _CogBlobReferResult.BlobMinY = new double[1]; _CogBlobReferResult.BlobCenterX = new double[1]; _CogBlobReferResult.BlobCenterY = new double[1]; _CogBlobReferResult.Width = new double[1]; _CogBlobReferResult.Height = new double[1]; _CogBlobReferResult.OriginX = new double[1]; _CogBlobReferResult.OriginY = new double[1]; _CogBlobReferResult.IsGoods = new bool[1]; _CogBlobReferResult.BlobMinX[0] = _InspRegion.CenterX - (_InspRegion.SideXLength / 2); _CogBlobReferResult.BlobMinY[0] = _InspRegion.CenterY - (_InspRegion.SideYLength / 2); _CogBlobReferResult.BlobCenterX[0] = _InspRegion.CenterX; _CogBlobReferResult.BlobCenterY[0] = _InspRegion.CenterY; _CogBlobReferResult.Width[0] = _InspRegion.SideXLength; _CogBlobReferResult.Height[0] = _InspRegion.SideXLength; _CogBlobReferResult.OriginX[0] = _InspRegion.CenterX; _CogBlobReferResult.OriginY[0] = _InspRegion.CenterY; _CogBlobReferResult.IsGood = false; } } else { CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - Blob not found!!", CLogManager.LOG_LEVEL.MID); _CogBlobReferResult.BlobMinX = new double[1]; _CogBlobReferResult.BlobMinY = new double[1]; _CogBlobReferResult.BlobCenterX = new double[1]; _CogBlobReferResult.BlobCenterY = new double[1]; _CogBlobReferResult.Width = new double[1]; _CogBlobReferResult.Height = new double[1]; _CogBlobReferResult.OriginX = new double[1]; _CogBlobReferResult.OriginY = new double[1]; _CogBlobReferResult.IsGoods = new bool[1]; _CogBlobReferResult.BlobMinX[0] = _InspRegion.CenterX - (_InspRegion.SideXLength / 2); _CogBlobReferResult.BlobMinY[0] = _InspRegion.CenterX - (_InspRegion.SideYLength / 2); _CogBlobReferResult.BlobCenterX[0] = _InspRegion.CenterX; _CogBlobReferResult.BlobCenterY[0] = _InspRegion.CenterY; _CogBlobReferResult.Width[0] = _InspRegion.SideXLength; _CogBlobReferResult.Height[0] = _InspRegion.SideXLength; _CogBlobReferResult.OriginX[0] = _InspRegion.CenterX; _CogBlobReferResult.OriginY[0] = _InspRegion.CenterY; _CogBlobReferResult.IsGood = false; } CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - Result : " + _CogBlobReferResult.IsGood.ToString(), CLogManager.LOG_LEVEL.MID); return(_Result); }