/// <summary> /// Average Pixel Value /// 0 if fully black /// 255 if fully white /// </summary> /// <param name="roi"></param> /// <param name="recipe"></param> /// <returns></returns> private static VisionMapCategory CalculateMapCategory( EROIBW8 roi, MapVisionParameters recipe) { float DiePresentThreshold = recipe.DiePresentThreshold; float averagePixelValue; EasyImage.PixelAverage(roi, out averagePixelValue); VisionMapCategory visionMapCategory = VisionMapCategory.Undefined; //if (averagePixelValue > TakenDieThreshold && averagePixelValue <= 256) visionMapCategory = VisionMapCategory.Taken; //else if (averagePixelValue > GoodDieThreshold && averagePixelValue <= TakenDieThreshold) visionMapCategory = VisionMapCategory.GoodDie; //else if (averagePixelValue > BadDieThreshold && averagePixelValue <= GoodDieThreshold) visionMapCategory = VisionMapCategory.BadDie; if (averagePixelValue > DiePresentThreshold) { visionMapCategory = VisionMapCategory.DieTaken; } else if (averagePixelValue <= DiePresentThreshold) { visionMapCategory = VisionMapCategory.DieRemain; } else { throw new Exception("Invalid vision Map Category"); } return(visionMapCategory); }
private bool TrainPattern(EROIBW8 trainROI, ref EImageBW8 trainImage, EPatternType patternType, float lightBalance = 0, bool autoTransitionThickness = true, int transitionThickness = 6) { bool reSuccess = false; try { lightBalance = lightBalance > 1 ? 1 : lightBalance; lightBalance = lightBalance < -1 ? -1 : lightBalance; Base.PatternType = patternType; Base.LightBalance = lightBalance; Base.AutoTransitionThickness = autoTransitionThickness; Base.TransitionThickness = 6; Base.Learn(trainROI); Base.CopyLearntPattern(trainImage); reSuccess = true; } catch (EException exc) { StackFrame[] stackFrames = new StackTrace(true).GetFrames(); clsLogFile.LogTryCatch(stackFrames, exc.Message, true, true); } catch (Exception ex) { StackFrame[] stackFrames = new StackTrace(true).GetFrames(); clsLogFile.LogTryCatch(stackFrames, ex.Message, true, true); } return(reSuccess); }
public void SaveEMatcher_Blank( PatternMatcherParameters param, string pattern1_FilePath, string pattern2_FilePath, string pattern1_ImageFilePath, string pattern2_ImageFilePath) { EImageBW8 blackImage = new EImageBW8(512, 512); EasyImage.Oper(EArithmeticLogicOperation.Copy, new EBW8(0), blackImage); // make it black EROIBW8 blackEROI = new EROIBW8(); blackEROI.OrgX = 0; blackEROI.OrgY = 0; blackEROI.Width = 512; blackEROI.Height = 512; blackEROI.Attach(blackImage); TeachAndSaveEMatcher( param, blackEROI, blackEROI, pattern1_FilePath, pattern2_FilePath, pattern1_ImageFilePath, pattern2_ImageFilePath); }
public List <EMatchPosition> MatchPattern(EROIBW8 ROIforMatching) { if (ROIforMatching == null) { throw new ArgumentNullException("ROIforMatching"); } if (!isPatternLearned_) { throw new Exception("Pattern is not learned"); } if (!isParametersSet_) { throw new Exception("Pattern Matching paramters is not set"); } EMatcher_.Match(ROIforMatching); List <EMatchPosition> matchedPositions = new List <EMatchPosition>(); for (int i = 0; i < EMatcher_.NumPositions; i++) { matchedPositions.Add(EMatcher_.GetPosition(i)); } return(matchedPositions); }
public Tuple <List <EMatchPosition>, List <EMatchPosition> > MatchPatterns( EROIBW8 EROI_forMatching) { if (EROI_forMatching == null) { throw new ArgumentNullException("ROI1forMatching"); } if (!isPatternReady) { throw new Exception("Pattern is not learned"); } if (!isParametersSet) { throw new Exception("Pattern Matching paramters is not set"); } EMatcher1_.Match(EROI_forMatching); EMatcher2_.Match(EROI_forMatching); List <EMatchPosition> matchedPositions_1 = new List <EMatchPosition>(); List <EMatchPosition> matchedPositions_2 = new List <EMatchPosition>(); for (int i = 0; i < EMatcher1_.NumPositions; i++) { matchedPositions_1.Add(EMatcher1_.GetPosition(i)); } for (int i = 0; i < EMatcher2_.NumPositions; i++) { matchedPositions_2.Add(EMatcher2.GetPosition(i)); } isPatternMatched_ = true; return(new Tuple <List <EMatchPosition>, List <EMatchPosition> >(matchedPositions_1, matchedPositions_2)); }
public Task LearningPatternTask( EROIBW8 patternforTeaching1, EROIBW8 patternforTeaching2) { return(Task.Run(() => { LearnPattern(patternforTeaching1, patternforTeaching2); })); }
public override void Initialize() { ocr = new EOCR(); Roi = new EROIBW8(); Roi.SetPlacement(0, 0, 300, 300); ResultData.Name = ocrConfig.ToolName; ResultData.StrParams.Clear(); ResultData.StrParams.Add("字符", ""); ParentTask.ResultDatas.Add(ResultData); }
private void MoudleFrm_Load(object sender, EventArgs e) { roi = new EROIBW8(); roi.SetPlacement(100, 100, 300, 300); mPicBox1.MRois.Add(roi); HideTabTitle(tabControl1); match = new EMatcher(); find = new EPatternFinder(); find.ContrastMode = EFindContrastMode.Normal; }
public void LearnPattern( EROIBW8 patternforTeaching) { if (patternforTeaching == null) { throw new ArgumentNullException("patternforTeaching"); } EMatcher_.ClearImage(); EMatcher_.LearnPattern(patternforTeaching); isPatternLearned_ = true; }
public override void Initialize() { Roi = new EROIBW8(); Roi.SetPlacement(0, 0, 300, 300); Matcher = new EMatcher(); Finder = new EPatternFinder(); ResultData.Name = matcherConfig.ToolName; ResultData.ValueParams.Clear(); ResultData.ValueParams.Add("数量", new float[] { 0 }); ResultData.ValueParams.Add("中心X", new float[] { 0 }); ResultData.ValueParams.Add("中心Y", new float[] { 0 }); ResultData.ValueParams.Add("角度", new float[] { 0 }); ParentTask.ResultDatas.Add(ResultData); }
public override void Initialize() { objData = new MObjData(CodedImage, ObjectSelection, -1); Roi = new EROIBW8(); Roi.SetPlacement(0, 0, 300, 300); ResultData.Name = objConfig.ToolName; ResultData.ValueParams.Clear(); ResultData.ValueParams.Add("斑点数量", new float[] { 0 }); ResultData.ValueParams.Add("斑点面积", new float[] { 0 }); ResultData.ValueParams.Add("斑点中心X", new float[] { 0 }); ResultData.ValueParams.Add("斑点中心Y", new float[] { 0 }); ResultData.ValueParams.Add("斑点重心X", new float[] { 0 }); ResultData.ValueParams.Add("斑点重心Y", new float[] { 0 }); ResultData.ValueParams.Add("斑点宽度", new float[] { 0 }); ResultData.ValueParams.Add("斑点高度", new float[] { 0 }); ResultData.ValueParams.Add("斑点角度", new float[] { 0 }); ParentTask.ResultDatas.Add(ResultData); }
public clsEasyFindPattern(PictureBox display, EPatternFinder ePatternFinder) { Display = display; Base = ePatternFinder; inputImage = new EImageBW8(); trainROI = new EROIBW8(); trainImage = new EImageBW8(); dragHandle = EDragHandle.NoHandle; patternTable = new DataTable("PatternTable"); patternTable.Columns.Add("Index"); patternTable.Columns.Add("Score"); patternTable.Columns.Add("Center_X"); patternTable.Columns.Add("Center_Y"); patternTable.Columns.Add("Angle (Deg)"); patternTable.Columns.Add("Scale (%)"); }
public void LearnPattern( EROIBW8 patternforTeaching1, EROIBW8 patternforTeaching2) { if (patternforTeaching1 == null) { throw new ArgumentNullException("patternforTeaching1"); } if (patternforTeaching2 == null) { throw new ArgumentNullException("patternforTeaching2"); } //EMatcher1_.ClearImage(); EMatcher1_.LearnPattern(patternforTeaching1); //EMatcher2_.ClearImage(); EMatcher2_.LearnPattern(patternforTeaching2); isPatternReady = true; }
//public void TeachAndSaveEMatcher( // PatternMatcherParameters param, // EROIBW8 patternforTeaching1, // EROIBW8 patternforTeaching2, // string pattern1_FilePath, // string pattern2_FilePath) //{ // SetParameters(param); // LearningPatternTask(patternforTeaching1, patternforTeaching2); // if (!Directory.Exists(pattern1_FilePath)) Directory.CreateDirectory(Path.GetDirectoryName(pattern1_FilePath)); // if (!Directory.Exists(pattern2_FilePath)) Directory.CreateDirectory(Path.GetDirectoryName(pattern2_FilePath)); // EMatcher1_.Save(pattern1_FilePath); // EMatcher2_.Save(pattern2_FilePath); //} public void TeachAndSaveEMatcher( PatternMatcherParameters param, EROIBW8 patternforTeaching1, EROIBW8 patternforTeaching2, string pattern1_FilePath, string pattern2_FilePath, string pattern1_ImageFilePath, string pattern2_ImageFilePath) { SetParameters(param); LearningPatternTask(patternforTeaching1, patternforTeaching2); Directory.CreateDirectory(Path.GetDirectoryName(pattern1_FilePath)); Directory.CreateDirectory(Path.GetDirectoryName(pattern2_FilePath)); EMatcher1_.Save(pattern1_FilePath); EMatcher2_.Save(pattern2_FilePath); patternforTeaching1.Save(pattern1_ImageFilePath); patternforTeaching2.Save(pattern2_ImageFilePath); }
private bool ShowROI(PictureBox display, EROIBW8 roi, bool handles = true, bool autoSize = false) { bool reSuccess = false; try { Bitmap bmp = new Bitmap(display.Width, display.Height); if (autoSize) { float scalingRatio = ScalingRatio(InputImage, display); roi.DrawFrame(Graphics.FromImage(bmp), handles, scalingRatio); } else { roi.DrawFrame(Graphics.FromImage(bmp), handles, zoomX, zoomY, (panX - mouseX) * (1 / zoomX), (panY - mouseY) * (1 / zoomY)); } if (display.InvokeRequired) { display.Invoke(new Action(() => { display.Image = bmp; })); } else { display.Image = bmp; } reSuccess = true; } catch (EException exc) { StackFrame[] stackFrames = new StackTrace(true).GetFrames(); clsLogFile.LogTryCatch(stackFrames, exc.Message, true, true); } catch (Exception ex) { StackFrame[] stackFrames = new StackTrace(true).GetFrames(); clsLogFile.LogTryCatch(stackFrames, ex.Message, true, true); } return(reSuccess); }
private void _ShapeMatch(EROIBW8 bw8, ref List <PositionInfo> _Resultlist) { try { m_match.Match(bw8); for (int i = 0; i < m_match.NumPositions; i++) { PositionInfo info = new PositionInfo(); EMatchPosition pos = m_match.GetPosition(i); info.CenterX = pos.CenterX; info.CenterY = pos.CenterY; info.angle = pos.Angle; info.scaleX = pos.ScaleX; info.scaleY = pos.ScaleY; info.score = pos.Score; _Resultlist.Add(info); } } catch (EException) { // Insert exception handling code here } }
public static PatternMatchingTransformationResult Execute( EImageBW8 eImage, float max_AngleOffset, float max_XTranslateOffset, float max_YTranslateOffset, int maxNumberOfTrial, EuresysDoublePatternMatcher eMatcher, PatternMatcherParameters patternMatcherParameters, EROIBW8 matcherROI, ELineGauge gauge1, ELineGauge gauge2, ELineGauge gauge3, ELineGauge gauge4, double filterTolerance, double fiducialOffset, WaferOrientation fiducialOrientation, bool isIncludeFiducialTolerance, Func <ELineGauge, ELineGauge, ELineGauge, ELineGauge, EImageBW8, double, double, WaferOrientation, bool, PointF> FindCenter, PointF TeacherMidPoint) { List <string> messages = new List <string>(); float thetaOffset = -1; float xOffset = -1; float yOffset = -1; bool isPass = false; bool isThetaOffsetWithinTolerance = false; bool isXOffsetWithinTolerance = false; bool isYOffsetWithinTolerance = false; int xTranslationCount = -1; int yTranslationCount = -1; int thetaTranslationCount = -1; PointF calibratedCenterPoint = new PointF( patternMatcherParameters.WaferCenterXPos, patternMatcherParameters.WaferCenterYPos); PointF currentWaferCenterPoint = new PointF(-1, -1); EuresysDoubleMatcherResults matchedResult = null; messages.Add("Maximum NumberOfTrial is " + maxNumberOfTrial); messages.Add("Accepted AngleOffset is below " + max_AngleOffset); messages.Add("Accepted X Offset is below " + max_XTranslateOffset); messages.Add("Accepted Y Offset is below " + max_YTranslateOffset); #region X Offset for (int i = 0; i < maxNumberOfTrial; i++) { // Find X Offset currentWaferCenterPoint = FindCenter.Invoke( gauge1, gauge2, gauge3, gauge4, eImage, filterTolerance, fiducialOffset, fiducialOrientation, isIncludeFiducialTolerance); xOffset = calibratedCenterPoint.X - currentWaferCenterPoint.X; if (Math.Abs(xOffset) < max_XTranslateOffset) { isXOffsetWithinTolerance = true; xTranslationCount = i; messages.Add("XOffset within tolerance"); messages.Add("Number of X tranlation performed = " + xTranslationCount); break; } else { isXOffsetWithinTolerance = false; messages.Add(string.Format("XOffset: {0} out of tolerance", xOffset)); eImage = ImageTransformer.TranslateImage_X(eImage, xOffset); messages.Add("Image X Translated by " + xOffset); } if (i == maxNumberOfTrial) { xTranslationCount = i; messages.Add("Maximum number of trials for XOffset reached"); } } #endregion XOffset #region Y Offset for (int i = 0; i <= maxNumberOfTrial; i++) { // Find Y Offset currentWaferCenterPoint = FindCenter.Invoke( gauge1, gauge2, gauge3, gauge4, eImage, filterTolerance, fiducialOffset, fiducialOrientation, isIncludeFiducialTolerance); yOffset = calibratedCenterPoint.Y - currentWaferCenterPoint.Y; if (Math.Abs(yOffset) < max_YTranslateOffset) { isYOffsetWithinTolerance = true; yTranslationCount = i; messages.Add("YOffset within tolerance"); messages.Add("Number of Y tranlation performed = " + yTranslationCount); break; } else { isYOffsetWithinTolerance = false; messages.Add(string.Format("YOffset: {0} out of tolerance", yOffset)); eImage = ImageTransformer.TranslateImage_Y(eImage, yOffset); messages.Add("Image Y Translated by " + yOffset); } if (i == maxNumberOfTrial) { yTranslationCount = i; messages.Add("Maximum number of trials for YOffset reached"); } } #endregion Y offset #region Theta Offset if (isXOffsetWithinTolerance && isYOffsetWithinTolerance) { for (int i = 0; i <= maxNumberOfTrial; i++) { currentWaferCenterPoint = FindCenter.Invoke( gauge1, gauge2, gauge3, gauge4, eImage, filterTolerance, fiducialOffset, fiducialOrientation, isIncludeFiducialTolerance); EuresysEROIHelper.AttachROI(eImage, matcherROI); eMatcher.MatchPatterns(matcherROI); WaferOrientation patternOrientation = FindWaferOrientation(currentWaferCenterPoint, TeacherMidPoint); matchedResult = PatternMatcherParameterHelper.CreateDoublePatternMatcherResult( eMatcher, matcherROI, patternMatcherParameters.OriginalXPos_pattern1, patternMatcherParameters.OriginalYPos_pattern1, currentWaferCenterPoint, patternMatcherParameters.DefaultAngleOffset, patternOrientation); thetaOffset = matchedResult.AngleBetweenResult; if (thetaOffset > 180) { throw new ArgumentOutOfRangeException("theta Offset must not be higher than 180"); } else if (thetaOffset < -180) { throw new ArgumentOutOfRangeException("theta Offset must not be lesser than 180"); } if (Math.Abs(thetaOffset) < max_AngleOffset) { isThetaOffsetWithinTolerance = true; thetaTranslationCount = i; messages.Add("Theta Offset within tolerance"); messages.Add("Number of Theta tranlation performed = " + thetaTranslationCount); break; } else { isThetaOffsetWithinTolerance = false; messages.Add(string.Format("Theta Offset: {0} out of tolerance", thetaOffset)); eImage = ImageTransformer.RotateImage(eImage, thetaOffset, calibratedCenterPoint); messages.Add("Image Theta Rotated by " + thetaOffset + " around calibrated Center Point"); } if (i == maxNumberOfTrial) { thetaTranslationCount = i; messages.Add("Maximum number of trials for Theta Offset reached"); } } } else { if (!isXOffsetWithinTolerance) { messages.Add("Theta offset correction skipped due to X Offset out of tolerance"); } if (!isYOffsetWithinTolerance) { messages.Add("Theta offset correction skipped due to X Offset out of tolerance"); } } #endregion Theta Offset #region Final Result messages.Add("Final Angle is " + Math.Round(thetaOffset, 4)); messages.Add("Final X Offset is " + Math.Round(xOffset, 4)); messages.Add("Final Y Offset is " + Math.Round(yOffset, 4)); if (isThetaOffsetWithinTolerance && isXOffsetWithinTolerance && isYOffsetWithinTolerance) { isPass = true; messages.Add("Result is Pass"); } else { isPass = false; messages.Add("Result is False"); } return(new PatternMatchingTransformationResult() { MatchedResult = matchedResult, eImageAfterTransformation = eImage, FinalAngleOffset = thetaOffset, FinalXOffset = xOffset, FinalYOffset = yOffset, IsPass = isPass, IsThetaOffsetWithinTolerance = isThetaOffsetWithinTolerance, IsXOffsetWithinTolerance = isXOffsetWithinTolerance, IsYOffsetWithinTolerance = isXOffsetWithinTolerance, XTranlastionCount = xTranslationCount, YTranslationCount = yTranslationCount, ThetaTranslationCount = thetaTranslationCount, FinalWaferCenter = currentWaferCenterPoint, Messages = messages, }); #endregion Final Result }
public static EuresysDoubleMatcherResults CreateDoublePatternMatcherResult( EuresysDoublePatternMatcher matcher, EROIBW8 matcherEROI, float originalXPos_Pattern1, float originalYPos_Pattern1, PointF waferCenterPoint, double refAngle, WaferOrientation patternOrientation) { if (matcher == null) { throw new ArgumentNullException("matcher"); } if (!matcher.isPatternMatched_) { throw new ArgumentException("Pattern is not matched"); } if (matcher.EMatcher1.NumPositions < 1) { throw new ArgumentException("No occurance on EMatcher1"); } if (matcher.EMatcher2.NumPositions < 1) { throw new ArgumentException("No occurance on EMatcher2"); } if (matcher.EMatcher1.NumPositions > 1) { throw new ArgumentException("More than one occurance on EMatcher1"); } if (matcher.EMatcher2.NumPositions > 1) { throw new ArgumentException("More than one occurance on EMatcher2"); } if (matcher.EMatcher1.NumPositions != matcher.EMatcher2.NumPositions) { throw new ArgumentException("Occurance for EMatcher 1 and EMatcher 2 nota tally"); } EuresysDoubleMatcherResults result = new EuresysDoubleMatcherResults() { Angle1 = matcher.EMatcher1.GetPosition(0).Angle, ScaleX1 = matcher.EMatcher1.GetPosition(0).ScaleX, ScaleY1 = matcher.EMatcher1.GetPosition(0).ScaleY, CenterX1 = matcher.EMatcher1.GetPosition(0).CenterX + (float)(matcherEROI.OrgX), CenterY1 = matcher.EMatcher1.GetPosition(0).CenterY + (float)(matcherEROI.OrgY), Score1 = matcher.EMatcher1.GetPosition(0).Score, Angle2 = matcher.EMatcher2.GetPosition(0).Angle, ScaleX2 = matcher.EMatcher2.GetPosition(0).ScaleX, ScaleY2 = matcher.EMatcher2.GetPosition(0).ScaleY, CenterX2 = matcher.EMatcher2.GetPosition(0).CenterX + (float)(matcherEROI.OrgX), CenterY2 = matcher.EMatcher2.GetPosition(0).CenterY + (float)(matcherEROI.OrgY), Score2 = matcher.EMatcher2.GetPosition(0).Score, }; PointF p1 = new PointF(result.CenterX1, result.CenterY1); PointF p2 = new PointF(result.CenterX2, result.CenterY2); double angle = CalculateAngleBetween3Points.Execute(p1, p2, waferCenterPoint, refAngle, true, patternOrientation); if (angle > 45) { throw new Exception("angle should not be higher than 45 degree"); } if (angle < -45) { throw new Exception("angle should not be less than -45 degree"); } result.AngleBetweenResult = (float)angle; result.XOffset = originalXPos_Pattern1 - result.CenterX1; result.YOffset = originalYPos_Pattern1 - result.CenterY1; return(result); }
/// <summary> /// Match学习ROI /// </summary> /// <param name="image"></param> /// <param name="ppc"></param> internal void MatchLearnPattern(EROIBW8 bw8, PicturePanelC ppc) { _MatchLearnPattern(bw8, ppc); }
public static bool TeachTeacherROI( string RecipeName, EuresysDoublePatternMatcher PatternMatcher_, PatternMatcherParameters PatternMatcherParameters_, EROIBW8 eROIForPatternTeaching1_, EROIBW8 eROIForPatternTeaching2_, iEuresysROI MatcherEROI, PointF WaferCenterPoint, WaferOrientation patternOrientation) { string PatternFilePath_One = PatternMatcherParameterHelper.GetLeftPatternFilePath(RecipeName); string PatternFilePath_Two = PatternMatcherParameterHelper.GetRightPatternFilePath(RecipeName); string PatternImageFilePath_One = PatternMatcherParameterHelper.GetLeftPatternImageFilePath(RecipeName); string PatternImageFilePath_Two = PatternMatcherParameterHelper.GetRightPatternImageFilePath(RecipeName); PatternMatcher_.TeachAndSaveEMatcher( PatternMatcherParameters_, eROIForPatternTeaching1_, eROIForPatternTeaching2_, PatternFilePath_One, PatternFilePath_Two, PatternImageFilePath_One, PatternImageFilePath_Two); if (PatternMatcher_.Pattern1.IsVoid) { goto Fail; } if (PatternMatcher_.Pattern2.IsVoid) { goto Fail; } // Match EROIBW8 matcherROI = MatcherEROI.GetROI(0); PatternMatcher_.MatchPatterns(matcherROI); EMatcher eMatcher1 = PatternMatcher_.EMatcher1; EMatcher eMatcher2 = PatternMatcher_.EMatcher2; if (eMatcher1.NumPositions != 1) { string errorMessage = "Pattern 1: Number of patterns matched is not equal to one"; VisionLogger.Log(LogType.Exception, "PatternMatcherManager", errorMessage); VisionNotifier.AddNotification(errorMessage); goto Fail; } if (eMatcher2.NumPositions != 1) { string errorMessage = "Pattern 2: Number of patterns matched is not equal to one"; VisionLogger.Log(LogType.Exception, "PatternMatcherManager", errorMessage); VisionNotifier.AddNotification(errorMessage); goto Fail; } EROIBW8 matcherEROI_1 = MatcherEROI.GetROI(0); float OriginalXPos_pattern1 = eMatcher1.GetPosition(0).CenterX + (matcherEROI_1.OrgX); float OriginalYPos_pattern1 = eMatcher1.GetPosition(0).CenterY + (matcherEROI_1.OrgY); float OriginalXPos_pattern2 = eMatcher2.GetPosition(0).CenterX + (matcherEROI_1.OrgX); float OriginalYPos_pattern2 = eMatcher2.GetPosition(0).CenterY + (matcherEROI_1.OrgY); float WaferCenterXPos = WaferCenterPoint.X; float WaferCenterYPos = WaferCenterPoint.Y; PointF p1 = new PointF(OriginalXPos_pattern1, OriginalYPos_pattern1); PointF p2 = new PointF(OriginalXPos_pattern2, OriginalYPos_pattern2); float PatternDefaultAngleOffset = (float)CalculateAngleBetween3Points.Execute( p1, p2, WaferCenterPoint, 0, true, patternOrientation); // Replace value PatternMatcherParameters_.OriginalXPos_pattern1 = OriginalXPos_pattern1; PatternMatcherParameters_.OriginalYPos_pattern1 = OriginalYPos_pattern1; PatternMatcherParameters_.OriginalXPos_pattern2 = OriginalXPos_pattern2; PatternMatcherParameters_.OriginalYPos_pattern2 = OriginalYPos_pattern2; PatternMatcherParameters_.WaferCenterXPos = WaferCenterXPos; PatternMatcherParameters_.WaferCenterYPos = WaferCenterYPos; PatternMatcherParameters_.DefaultAngleOffset = PatternDefaultAngleOffset; return(true); Fail: return(false); }
public static MapDataFromVision ReadImage( MapVisionParameters recipe, EImageBW8 eImage) { if (recipe == null) { throw new ArgumentNullException("recipe"); } if (eImage == null) { throw new ArgumentNullException("eImage"); } int rowCount = recipe.RowCount; int columnCount = recipe.ColumnCount; float startingPointX = recipe.StartingPointX; float startingPointY = recipe.StartingPointY; float mapWidth = recipe.DieWidth; float mapHeight = recipe.DieHeight; List <List <BDMMapFromVision> > MapFromVisionListofList = new List <List <BDMMapFromVision> >(); for (int i = 0; i < rowCount; i++) { List <BDMMapFromVision> MapFromVisionList = new List <BDMMapFromVision>(); for (int j = 0; j < columnCount; j++) { EROIBW8 currentROI = new EROIBW8(); currentROI.Attach(eImage); float ROIpositionX = startingPointX + j * mapWidth; float ROIpositionY = startingPointY + i * mapHeight; currentROI.OrgX = (int)Math.Round(ROIpositionX); currentROI.OrgY = (int)Math.Round(ROIpositionY); currentROI.Width = (int)Math.Round(mapWidth); currentROI.Height = (int)Math.Round(mapHeight); VisionMapCategory visionMapCategory; // if roi out of image border if (currentROI.OrgX + currentROI.Width >= eImage.Width || currentROI.OrgY + currentROI.Height >= eImage.Height || currentROI.OrgX < 0 || currentROI.OrgY < 0) { visionMapCategory = VisionMapCategory.OutOfBound; } else { visionMapCategory = CalculateMapCategory(currentROI, recipe); } BDMMapFromVision currentMap = new BDMMapFromVision() { mapCategory = visionMapCategory, PointX = currentROI.OrgX, PointY = currentROI.OrgY, Width = mapWidth, Height = mapHeight, }; MapFromVisionList.Add(currentMap); } MapFromVisionListofList.Add(MapFromVisionList); } return(new MapDataFromVision() { MapsFromVision = MapFromVisionListofList, }); }