Пример #1
0
        public void SetImageList()
        {
            new FolderBrowserDialog()
            .Act(ths => ths.RootFolder   = Environment.SpecialFolder.MyComputer)                                   // for test
            .Act(ths => ths.SelectedPath = @"D:\03JobPro\2017\05_veeco\Mapping Data\5um Data 0602\VP_538\Resized") // for test
            .Act(ofd =>
            {
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    string[] imgpathslist = Directory.GetFiles(ofd.SelectedPath, "*.bmp");
                    var imgpaths          = imgpathslist
                                            .Select(Path.GetFileName)
                                            .ToArray();

                    if (imgpaths.GetLength(0) != 6)
                    {
                        MessageBox.Show("Please check files or folder");
                        SetImageList();
                    }
                    else
                    {
                        imgpathslist.ActLoop(path =>
                                             EpiColorImgDic.Add(path.TrimFileNameOnly()
                                                                .Map2ImgPos()
                                                                , new Image <Bgr, byte>(path)));

                        evtTrsFullImg(
                            imgpathslist.Map2ImgZipedPos()
                            .ActLoop(pair => EpiGrayImgDic.Add(pair.Item1, pair.Item2))
                            .ToArray());
                    }
                }
            });
        }
Пример #2
0
        public void SetImage(Nullable <int> row, Nullable <int> col, string path)
        {
            var pos     = Pos2EnumTable[Tuple.Create(row, col)];
            var testimg = new Image <Bgr, byte>(path);



            EpiColorImgDic.Add(pos
                               , new Image <Bgr, byte>(path));

            new Image <Gray, byte>(path)
            .Act(img => EpiGrayImgDic.Add(
                     pos
                     , img))
            .Act(img => evtDroppedImg(
                     pos
                     , img));
        }
Пример #3
0
        public async void EpiProcessing(int resolution, int areaUpLimit, int areaDwlimit, int outerexclude = 0)
        {
            try
            {
                Stopwatch stw = new Stopwatch();
                stw.Start();
                SampleResolution = resolution;
                if (outerexclude > 0)
                {
                    OuterExcludeSize = outerexclude;
                }
                AreaUp = areaUpLimit;
                AreaDw = areaDwlimit;

                var totalImgSize = EpiGrayImgDic[ImgIdxPos.TL].Width
                                   + EpiGrayImgDic[ImgIdxPos.TM].Width
                                   + EpiGrayImgDic[ImgIdxPos.TR].Width;

                if (EpiGrayImgDic.Count != 6)
                {
                    return;
                }
                ResetData();
                EpiProcedImgDic = EpiColorImgDic.ToDictionary(x => x.Key
                                                              , x => x.Value.Normalize(64).Gamma(1.4));

                Offset = CreateOffset(EpiGrayImgDic [ImgIdxPos.TL].Height
                                      , EpiGrayImgDic [ImgIdxPos.TL].Width
                                      , EpiGrayImgDic [ImgIdxPos.TL].Width + EpiGrayImgDic [ImgIdxPos.TM].Width);

                var dfInfoDic = EpiGrayImgDic.ToDictionary(
                    dic => dic.Key
                    , dic => EpiProcFnList[dic.Key.ImgIdx2EpiMethod()]
                        (dic.Value))

                                .ToDictionary(
                    dic => dic.Key
                    , dic =>
                    dic.Value.FindContour(AreaUp, AreaDw))

                                .ToDictionary(
                    dic => dic.Key
                    , dic => dic.Value.FindDefectInfo());                            //a


                List <Task> resultTaskList = new List <Task>();

                Enum.GetValues(typeof(ImgIdxPos))
                .Cast <ImgIdxPos>()
                .ActLoop(pos =>
                {
                    resultTaskList.Add(Task.Run(( Action )(() =>
                                                           DrawCircleSequance(
                                                               EpiProcedImgDic [pos] // Destination
                                                               , dfInfoDic [pos]     // box list
                                                               , dfInfoDic [pos].Count()))));
                })
                .ActLoop(pos =>
                {
                    resultTaskList.Add(Task.Run(( Action )(() =>
                                                           CreateResult(
                                                               EpiProcResultDict [pos].DefectList       // Destination
                                                               , dfInfoDic [pos]                        // Src
                                                               , dfInfoDic [pos].Count()
                                                               , SampleResolution))));
                });
                Task all = Task.WhenAll(resultTaskList.ToArray());

                try
                {
                    await all;
                    // Result Combine
                    var combined = Enum.GetValues(typeof(ImgIdxPos))
                                   .Cast <ImgIdxPos>()
                                   .Select(pos => EpiProcResultDict [pos].DefectList
                                           .ShiftDefectData(Offset, pos, SampleResolution))
                                   .Aggregate((f, s) => f.Concate_H(s))
                                   .Where(x => VectorLen((x.CenterX - Offset[OffsetPos.Row1]), (x.CenterY - Offset[OffsetPos.Row1])) < Offset[OffsetPos.Row1] - OuterExcludeSize)
                                   .Select(x => x)
                                   .ToList();
                    //.Act( x=> evtProgressTime( 85 )); // 컴바인 result


                    EpiProcResult_FullScale.DefectList = new List <DefectData>(combined);
                    EpiProcResul_IdxScale.DefectList   = combined.Convert2IdxPos(totalImgSize, totalImgSize, waferIndexImgSize, SampleResolution);
                    IndexViewImg = IndexViewImg.DrawIdxDefect(EpiProcResul_IdxScale.DefectList);   // Draw Index View Image

                    /* Start Side Effect */
                    evtTrsIdxImg(IndexViewImg);
                    evtTrsResizedProcedImg(Origin2ResizedImg((double)waferIndexImgSize / (double)50000
                                                             , EpiColorImgDic.First().Value.Width
                                                             , EpiColorImgDic.First().Value.Height
                                                             , EpiProcedImgDic)
                                           .StackSplitted());

                    CreateStatisticResult(EpiProcResult_FullScale);
                    evtStatistic(new int [] { EpiProcResult_FullScale.Size1Number
                                              , EpiProcResult_FullScale.Size2Number
                                              , EpiProcResult_FullScale.Size3Number
                                              , EpiProcResult_FullScale.Size4Number });
                    stw.Stop();
                    stw.ElapsedMilliseconds.Print(" Processing Time");
                    evtProcTime((int)stw.ElapsedMilliseconds);
                }
                catch (Exception e)
                {
                    e.ToString().Print(" Main Processing Error ");
                }
            }
            catch (Exception e)
            {
                e.ToString().Print(" Main Processing Error ");
            }
        }