Ejemplo n.º 1
0
        private void btnUnitPatternAreaSet_Click(object sender, EventArgs e)
        {
            #region Button Status
            btnUnitPatternSearchAreaShow.Enabled  = true;        btnUnitPatternSearchAreaShow.BackColor = Color.SandyBrown;
            btnUnitPatternSearchAreaSet.Enabled   = false;        btnUnitPatternSearchAreaSet.BackColor = Color.Gray;
            btnUnitPatternOriginCenterSet.Enabled = false;      btnUnitPatternOriginCenterSet.BackColor = Color.Gray;
            btnUnitPatternAreaShow.Enabled        = true;              btnUnitPatternAreaShow.BackColor = Color.PaleGreen;
            btnUnitPatternAreaSet.Enabled         = false;              btnUnitPatternAreaSet.BackColor = Color.Gray;
            //btnUnitPatternAreaCancel.Enabled = false;
            #endregion Button Status

            CogRectangle   _PatternRegion = kpTeachDisplay.GetInterActiveRectangle();
            CogPointMarker _PatternOrigin = new CogPointMarker();
            _PatternOrigin.SetCenterRotationSize(_PatternRegion.CenterX, _PatternRegion.CenterY, 0, 2);

            kpTeachDisplay.ClearDisplay("PatternRegion");
            kpTeachDisplay.ClearDisplay("PatternOriginPoint");
            kpTeachDisplay.DrawStaticShape(_PatternRegion, "PatternRegion", CogColorConstants.Green, 2, CogGraphicLineStyleConstants.Dash);
            kpTeachDisplay.DrawStaticShape(_PatternOrigin, "PatternOriginPoint", CogColorConstants.Green, 14);

            MapDataParam.Unit.PatternAreaCenterX = _PatternRegion.CenterX;
            MapDataParam.Unit.PatternAreaCenterY = _PatternRegion.CenterY;
            MapDataParam.Unit.PatternAreaWidth   = _PatternRegion.Width;
            MapDataParam.Unit.PatternAreaHeight  = _PatternRegion.Height;
            MapDataParam.Unit.PatternAreaOriginX = _PatternOrigin.X;
            MapDataParam.Unit.PatternAreaOriginY = _PatternOrigin.Y;

            //Pattern 등록
            CogPMAlignPattern _Pattern = InspPattern.GetPatternReference(OriginImage, _PatternRegion, _PatternOrigin.X, _PatternOrigin.Y);
            kpPatternDisplay.SetDisplayImage((CogImage8Grey)_Pattern.GetTrainedPatternImage());
            MapDataParam.Info.UnitPattern = _Pattern;

            SelectingRectName = SelectedRectName = "";
            IsDrawPatterns    = false;
        }
Ejemplo n.º 2
0
        public bool GetPatternReference(CogImage8Grey _SrcImage, CogRectangle _Region, double _OriginX, double _OriginY, ref CogPMAlignPattern _Pattern)
        {
            //CogPMAlignPattern _Pattern = new CogPMAlignPattern();

            _Pattern = new CogPMAlignPattern();
            CogRectangleAffine _ReferRegionAffine = new CogRectangleAffine();

            _ReferRegionAffine.SetCenterLengthsRotationSkew(_Region.CenterX, _Region.CenterY, _Region.Width, _Region.Height, 0, 0);

            CogAffineTransformTool _AffineTool = new CogAffineTransformTool();

            _AffineTool.InputImage = _SrcImage;
            _AffineTool.Region     = _ReferRegionAffine;
            _AffineTool.Run();

            _Pattern.TrainImage          = (CogImage8Grey)_AffineTool.OutputImage;
            _Pattern.TrainRegion         = _ReferRegionAffine;
            _Pattern.Origin.TranslationX = _OriginX;
            _Pattern.Origin.TranslationY = _OriginY;

            try
            {
                _Pattern.Train();
            }

            catch
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        private bool Inspection(CogImage8Grey _SrcImage, CogRectangle _InspArea, bool _IsRotate = false)
        {
            bool _Result = true;

            try
            {
                if (true == _IsRotate)
                {
                    CogRectangleAffine _Area = new CogRectangleAffine();
                    _Area.SetCenterLengthsRotationSkew(_InspArea.CenterX, _InspArea.CenterY, _InspArea.Width, _InspArea.Height, -3.14, 0);
                    IDResults = IDProc.Execute(_SrcImage, _Area);
                }
                else
                {
                    IDResults = IDProc.Execute(_SrcImage, _InspArea);
                }
            }
            catch (Exception ex)
            {
                CLogManager.AddSystemLog(CLogManager.LOG_TYPE.ERR, "InspectionID - Inspection Exception : " + ex.ToString(), CLogManager.LOG_LEVEL.LOW);
                _Result = false;
            }

            return(_Result);
        }
Ejemplo n.º 4
0
        private void btnLeadLengthAreaCheck_Click(object sender, EventArgs e)
        {
            if (false == IsLeadBodyCheck)
            {
                MessageBox.Show("Check [Lead Body] first!!"); return;
            }

            CogRectangle _InspRegion = new CogRectangle();

            _InspRegion.SetCenterWidthHeight(LeadMeasureArea.CenterX, LeadMeasureArea.CenterY, LeadMeasureArea.Width, LeadMeasureArea.Height);

            CogLeadTrimResult _CogLeadTrimResult = new CogLeadTrimResult();

            var _ApplyLeadTrimValueEvent = ApplyLeadTrimValueEvent;

            _ApplyLeadTrimValueEvent?.Invoke(CogLeadTrimAlgo.eAlgoMode.LEAD_MEASURE, _InspRegion, CogLeadTrimAlgoRcp, ref _CogLeadTrimResult);

            //CogLeadTrimAlgoRcp.LeadCount = _CogLeadTrimResult.LeadCount;
            //LJH 2019.07.30 Lead Count를 잘 못 입력하지 않도록 수동으로 입력하게 수정
            //SaveAlgo에서 확인하도록 수정
            numUpDownLeadCount.Value = Convert.ToDecimal(_CogLeadTrimResult.LeadCount);
            if (LEAD_COUNT != _CogLeadTrimResult.LeadCount)
            {
                MessageBox.Show("Lead 수가 맞지 않습니다.");
                return;
            }

            SetLeadMeasurementValue(_CogLeadTrimResult);
            SetGridViewLeadMeasurementValue(LeadLengthArrayNew, LeadPitchArrayNew);
            //SetGridViewLeadMeasurementValue(_CogLeadTrimResult);
        }
Ejemplo n.º 5
0
        private void btnLeadFormAlignAreaCheck_Click(object sender, EventArgs e)
        {
            CogRectangle _InspRegion = new CogRectangle();

            _InspRegion.SetCenterWidthHeight(LeadFormAlignArea.CenterX, LeadFormAlignArea.CenterY, LeadFormAlignArea.Width, LeadFormAlignArea.Height);

            CogLeadFormResult _CogLeadFormResult = new CogLeadFormResult();
            CogLeadFormAlgo   _CogLeadFormAlgo   = new CogLeadFormAlgo(ResolutionX, ResolutionY);

            _CogLeadFormAlgo.AlignThreshold = Convert.ToInt32(graLabelLeadFormAlignThresholdValue.Text);
            _CogLeadFormAlgo.AlignSkewSpec  = Convert.ToDouble(numUpDownAlignSkewSpec.Value);
            _CogLeadFormAlgo.AlignPitchSpec = Convert.ToDouble(numUpDownLeadFormAlignPitchSpec.Value);

            var _ApplyLeadFormValueEvent = ApplyLeadFormValueEvent;

            _ApplyLeadFormValueEvent?.Invoke(CogLeadFormAlgo.eAlgoMode.LEAD_ALIGN, _InspRegion, _CogLeadFormAlgo, ref _CogLeadFormResult);

            //LJH 2019.07.30 Lead Count를 잘 못 입력하지 않도록 수동으로 입력하게 수정\
            //SaveAlgo에서 확인 하도록 수정
            numUpDownLeadCount.Value = Convert.ToDecimal(_CogLeadFormResult.LeadCount);

            SetLeadAlignmentValue(_CogLeadFormResult);
            SetGridViewLeadAlignmentValue(LeadPositionArrayXNew, LeadPositionArrayYNew);
            //SetGridViewLeadAlignmentValue(_CogLeadFormResult);
        }
Ejemplo n.º 6
0
        private void ShowSearchArea()
        {
            if (MapDataParam.Info.UnitListCenterX == null || MapDataParam.Info.UnitListCenterY == null)
            {
                return;
            }
            if (MapDataParam.Info.UnitListCenterX.Count == 0 || MapDataParam.Info.UnitListCenterY.Count == 0)
            {
                return;
            }
            if (MapDataParam.Info.UnitListCenterX.Count != MapDataParam.Info.UnitListCenterY.Count)
            {
                return;
            }

            uint _RowCount   = Convert.ToUInt32(numUpDownUnitRowCount.Value);
            uint _ColCount   = Convert.ToUInt32(numUpDownUnitColumnCount.Value);
            int  _TotalCount = MapDataParam.Info.UnitListCenterX.Count;

            if (_TotalCount != (_RowCount * _ColCount))
            {
                MessageBox.Show(string.Format("Total : {0}, Row : {1}, Column : {2}", _TotalCount, _RowCount, _ColCount)); return;
            }
            CenterPoint[] _CenterPointArray = new CenterPoint[_TotalCount];
            for (int iLoopCount = 0; iLoopCount < _TotalCount; ++iLoopCount)
            {
                _CenterPointArray[iLoopCount]   = new CenterPoint();
                _CenterPointArray[iLoopCount].X = MapDataParam.Info.UnitListCenterX[iLoopCount];
                _CenterPointArray[iLoopCount].Y = MapDataParam.Info.UnitListCenterY[iLoopCount];
            }
            CenterPoint[,] _SortedCenterPoint = CenterPointSort((uint)_RowCount, (uint)_ColCount, _CenterPointArray);
            MapDataParam.Info.UnitListCenterX.Clear();
            MapDataParam.Info.UnitListCenterY.Clear();
            for (int iLoopCount = 0; iLoopCount < _RowCount; ++iLoopCount)
            {
                for (int jLoopCount = 0; jLoopCount < _ColCount; ++jLoopCount)
                {
                    MapDataParam.Info.UnitListCenterX.Add(_SortedCenterPoint[iLoopCount, jLoopCount].X);
                    MapDataParam.Info.UnitListCenterY.Add(_SortedCenterPoint[iLoopCount, jLoopCount].Y);
                }
            }

            kpTeachDisplay.ClearDisplay();
            for (int iLoopCount = 0; iLoopCount < MapDataParam.Info.UnitListCenterX.Count; ++iLoopCount)
            {
                CogRectangle _FindPattern = new CogRectangle();
                _FindPattern.SetCenterWidthHeight(MapDataParam.Info.UnitListCenterX[iLoopCount], MapDataParam.Info.UnitListCenterY[iLoopCount],
                                                  MapDataParam.Info.UnitListWidth[iLoopCount], MapDataParam.Info.UnitListHeight[iLoopCount]);
                kpTeachDisplay.DrawStaticShape(_FindPattern, "SearchArea" + (iLoopCount + 1));

                CogPointMarker _OriginPoint = new CogPointMarker();
                _OriginPoint.SetCenterRotationSize(MapDataParam.Info.UnitListCenterX[iLoopCount], MapDataParam.Info.UnitListCenterY[iLoopCount], 0, 2);
                kpTeachDisplay.DrawStaticShape(_OriginPoint, "PatternOrigin" + (iLoopCount + 1), CogColorConstants.Green, 12);

                kpTeachDisplay.DrawText((iLoopCount + 1).ToString(), MapDataParam.Info.UnitListCenterX[iLoopCount], MapDataParam.Info.UnitListCenterY[iLoopCount] - 15, CogColorConstants.Green, 10);
            }

            SelectingRectName = SelectedRectName = "";
            IsDrawPatterns    = true;
        }
Ejemplo n.º 7
0
        //*****************************************************************************************
        // Conversion
        //*****************************************************************************************


        public void Do_Ptrn(Bitmap bmpSource, Bitmap bmpTemplate)
        {
            CogRectangleAffine PatMaxTrainRegion = default(CogRectangleAffine);

            PatMaxTrainRegion = PatMaxTool.Pattern.TrainRegion as CogRectangleAffine;

            ICogImage cogInput = this.Conv_BitmapToCog8Grey(bmpSource);
            ICogImage cogTeach = this.Conv_BitmapToCog8Grey(bmpTemplate);

            int imageW = bmpSource.Width;
            int imageH = bmpSource.Height;

            int teachW = bmpTemplate.Width;
            int teachH = bmpTemplate.Height;


            lock (locker)
            {
                CogRectangle PatMaxSearchRegion = new CogRectangle();
                PatMaxTool.SearchRegion = PatMaxSearchRegion;
                PatMaxSearchRegion.SetCenterWidthHeight(PARAM_SEARCH_CX, PARAM_SEARCH_CY, PARAM_RC_SEARCH.Width, PARAM_RC_SEARCH.Height);
                PatMaxSearchRegion.GraphicDOFEnable = CogRectangleDOFConstants.Position | CogRectangleDOFConstants.Size;
                PatMaxSearchRegion.Interactive      = true;

                if ((PatMaxTrainRegion != null))
                {
                    PatMaxTrainRegion.SetCenterLengthsRotationSkew(teachW / 2, teachH / 2, teachW, teachH, 0, 0);
                    PatMaxTrainRegion.GraphicDOFEnable = CogRectangleAffineDOFConstants.Position |
                                                         CogRectangleAffineDOFConstants.Rotation |
                                                         CogRectangleAffineDOFConstants.Size;
                }

                try
                {
                    PatMaxTool.Pattern.TrainImage     = cogTeach as CogImage8Grey;
                    PatMaxTool.Pattern.TrainAlgorithm = CogPMAlignTrainAlgorithmConstants.PatMax;
                    PatMaxTool.Pattern.TrainMode      = CogPMAlignTrainModeConstants.Image;
                    PatMaxTool.Pattern.Train();
                }
                catch (CogSecurityViolationException ex)
                {
                    MessageBox.Show("Please Check The License Dongle Validity.", "LISENCE ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }

                PatMaxTool.InputImage = cogInput;
                PatMaxTool.RunParams.ApproximateNumberToFind = 100;
                PatMaxTool.RunParams.AcceptThreshold         = 0.5;

                //PatMaxTool.Changed += PatMaxTool_Changed;

                ptrnResult.removeAll();
                PatMaxTool.Run();
            }
        }
Ejemplo n.º 8
0
 public void DrawStaticShapeNotClear(CogRectangle _cogRect, string _groupName, CogColorConstants _color, int _LineSize = 2)
 {
     StaticRectGraphic       = new CogRectangle();
     StaticRectGraphic       = _cogRect;
     StaticRectGraphic.Color = _color;
     StaticRectGraphic.LineWidthInScreenPixels = _LineSize;
     StaticRectGraphic.Selected = false;
     kCogDisplay.StaticGraphics.Add(StaticRectGraphic.CopyBase(CogCopyShapeConstants.All), _groupName);
 }
Ejemplo n.º 9
0
        public CogRectangle GetInterActiveRectangle()
        {
            CogRectangle cogRectangle = new CogRectangle();
            double       CenterX, CenterY, Width, Height;

            InteractiveRectGraphic.GetCenterWidthHeight(out CenterX, out CenterY, out Width, out Height);
            cogRectangle.SetCenterWidthHeight(CenterX, CenterY, Width, Height);
            return(cogRectangle);
        }
Ejemplo n.º 10
0
        private void btnMapIDSearchAreaShow_Click(object sender, EventArgs e)
        {
            CogRectangle _MapIDRegion = new CogRectangle();

            _MapIDRegion.SetCenterWidthHeight(MapDataParam.MapID.SearchAreaCenterX, MapDataParam.MapID.SearchAreaCenterY, MapDataParam.MapID.SearchAreaWidth, MapDataParam.MapID.SearchAreaHeight);

            kpTeachDisplay.ClearDisplay();
            kpTeachDisplay.DrawInterActiveShape(_MapIDRegion, "MapIDRegion", CogColorConstants.Green);
        }
Ejemplo n.º 11
0
 public void DrawStaticShape(CogRectangle _cogRect, string _groupName, bool ClearFlag = false)
 {
     StaticRectGraphic       = new CogRectangle();
     StaticRectGraphic       = _cogRect;
     StaticRectGraphic.Color = CogColorConstants.Green;
     StaticRectGraphic.LineWidthInScreenPixels = 2;
     StaticRectGraphic.Selected = false;
     kCogDisplay.ClearDisplay("DistanceDrawRegion");
     kCogDisplay.StaticGraphics.Add(StaticRectGraphic.CopyBase(CogCopyShapeConstants.All), _groupName);
 }
Ejemplo n.º 12
0
        private void btnUnitPatternOriginCenterSet_Click(object sender, EventArgs e)
        {
            CogRectangle   _PatternRegion = kpTeachDisplay.GetInterActiveRectangle();
            CogPointMarker _PatternOrigin = new CogPointMarker();

            _PatternOrigin.SetCenterRotationSize(_PatternRegion.CenterX, _PatternRegion.CenterY, 0, 2);

            kpTeachDisplay.ClearDisplay("PatternOriginPoint");
            kpTeachDisplay.DrawInterActiveShape(_PatternOrigin, "PatternOriginPoint", CogColorConstants.Green, 14);
        }
Ejemplo n.º 13
0
        private void btnShowArea_Click(object sender, EventArgs e)
        {
            CogRectangle _Region = new CogRectangle();

            _Region.SetCenterWidthHeight(200, 200, 200, 200);

            var _DrawReferRegionEvent = DrawReferRegionEvent;

            _DrawReferRegionEvent?.Invoke(_Region, _Region.CenterX, _Region.CenterY, CogColorConstants.Cyan);
        }
Ejemplo n.º 14
0
        public void Initialize(MapDataParameter _MapDataParam)
        {
            SetMapDataParameter(_MapDataParam);
            InspPattern   = new InspectionPattern();
            InspBlobRefer = new InspectionBlobReference();

            SelectingRect = null;
            SelectedRect  = null;
            kpTeachDisplay.MousePointEvent += new KPDisplay.KPCogDisplayControl.MousePointHandler(TeachDisplayDownEventFunction);
        }
Ejemplo n.º 15
0
        private void btnLeadFormAlignAreaShow_Click(object sender, EventArgs e)
        {
            CogRectangle _Region = new CogRectangle();

            _Region.SetCenterWidthHeight(LeadFormAlignArea.CenterX, LeadFormAlignArea.CenterY, LeadFormAlignArea.Width, LeadFormAlignArea.Height);

            var _DrawRegionEvent = DrawRegionEvent;

            _DrawRegionEvent?.Invoke(_Region, false);
        }
Ejemplo n.º 16
0
        public bool Run(CogImage8Grey _SrcImage, CogRectangle _InspRegion, CogBlobAlgo _CogBlobAlgo, ref CogBlobResult _CogBlobResult, int _NgNumber = 0)
        {
            bool _Result = true;

            SetHardFixedThreshold(_CogBlobAlgo.ThresholdMin);
            SetConnectivityMinimum((int)_CogBlobAlgo.BlobAreaMin);
            SetPolarity(Convert.ToBoolean(_CogBlobAlgo.ForeGround));
            //SetMeasurement(CogBlobMeasureConstants.Area, CogBlobMeasureModeConstants.Filter, CogBlobFilterModeConstants.IncludeBlobsInRange, _CogBlobReferAlgo.BlobAreaMin, _CogBlobReferAlgo.BlobAreaMax);

            return(_Result);
        }
Ejemplo n.º 17
0
        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);
        }
Ejemplo n.º 18
0
        private void btnMapIDSet_Click(object sender, EventArgs e)
        {
            CogRectangle _MapIDRegion = kpTeachDisplay.GetInterActiveRectangle();

            kpTeachDisplay.DrawStaticShape(_MapIDRegion, "PatternRegion", CogColorConstants.Green, 2, CogGraphicLineStyleConstants.Dash);

            MapDataParam.MapID.SearchAreaCenterX = _MapIDRegion.CenterX;
            MapDataParam.MapID.SearchAreaCenterY = _MapIDRegion.CenterY;
            MapDataParam.MapID.SearchAreaWidth   = _MapIDRegion.Width;
            MapDataParam.MapID.SearchAreaHeight  = _MapIDRegion.Height;
        }
Ejemplo n.º 19
0
        private void btnShowArea_Click(object sender, EventArgs e)
        {
            int Num = Convert.ToInt32(((Button)sender).Tag);

            CogRectangle _Region = new CogRectangle();

            _Region.SetCenterWidthHeight(200, 200, 200, 200);

            var _DrawReferRegionEvent = DrawReferRegionEvent;

            _DrawReferRegionEvent?.Invoke(_Region, _Region.CenterX, _Region.CenterY, CogColorConstants.Cyan);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 수정이 가능한 도형 그리기
        /// </summary>
        /// <param name="_cogRectAffine">RectAffine 객체</param>
        /// <param name="_groupName">그려지는 그룹명</param>
        /// <param name="_color">색상</param>
        public void DrawInterActiveShape(CogRectangle _cogRect, string _groupName, CogColorConstants _color)
        {
            InteractiveRectGraphic                         = new CogRectangle();
            InteractiveRectGraphic                         = _cogRect;
            InteractiveRectGraphic.Interactive             = true;
            InteractiveRectGraphic.Color                   = _color;
            InteractiveRectGraphic.LineWidthInScreenPixels = 2;
            InteractiveRectGraphic.GraphicDOFEnable        = CogRectangleDOFConstants.All;

            kCogDisplay.ClearDisplay(_groupName);
            kCogDisplay.InteractiveGraphics.Add(InteractiveRectGraphic, _groupName, true);
        }
Ejemplo n.º 21
0
        private bool Inspection(CogImage8Grey _SrcImage, CogRectangle _Region, CogPMAlignPattern _Pattern)
        {
            bool _Result = false;

            HistogramResult = HistogramProc.Execute(_SrcImage, _Region);
            //HistogramResult.Mean;

            OneImageProc.InputImage = _SrcImage;
            //OneImageProc.Operators.Add()

            return(_Result);
        }
Ejemplo n.º 22
0
        private void btnLeadFormAlignAreaSet_Click(object sender, EventArgs e)
        {
            var          _GetRegionEvent = GetRegionEvent;
            CogRectangle _Region         = GetRegionEvent?.Invoke();

            var _DrawRegionEvent = DrawRegionEvent;

            _DrawRegionEvent?.Invoke(_Region, true);

            LeadFormAlignArea = new RectangleD();
            LeadFormAlignArea.SetCenterWidthHeight(_Region.CenterX, _Region.CenterY, _Region.Width, _Region.Height);
        }
Ejemplo n.º 23
0
        private void btnLeadTipAreaShow_Click(object sender, EventArgs e)
        {
            #region Button Status Set
            btnLeadTipAreaShow.Enabled = true;
            btnLeadTipAreaSet.Enabled  = true;
            #endregion

            CogRectangle _Region = new CogRectangle();
            _Region.SetCenterWidthHeight(LeadTipInspArea.CenterX + BodyCenterOffsetX, LeadTipInspArea.CenterY + BodyCenterOffsetY, LeadTipInspArea.Width, LeadTipInspArea.Height);

            var _DrawRegionEvent = DrawRegionEvent;
            _DrawRegionEvent?.Invoke(_Region, false);
        }
Ejemplo n.º 24
0
        private void btnGateRemainingAreaShow_Click(object sender, EventArgs e)
        {
            #region Button Status Set
            btnGateRemainingAreaShow.Enabled = true;
            btnGateRemainingAreaSet.Enabled  = true;
            #endregion

            CogRectangle _Region = new CogRectangle();
            _Region.SetCenterWidthHeight(GateRemainingArea.CenterX, GateRemainingArea.CenterY, GateRemainingArea.Width, GateRemainingArea.Height);

            var _DrawRegionEvent = DrawRegionEvent;
            _DrawRegionEvent?.Invoke(_Region, false);
        }
Ejemplo n.º 25
0
        //LDH, 2108.11.07, Auto Pattern Algo
        public bool AutoPatternFind(CogImage8Grey _SrcImage, CogRectangle _InspRegion, CogAutoPatternAlgo _CogAutoPatternAlgo, ref CogAutoPatternResult _CogAutoPatternResult)
        {
            bool _Result = false;

            //ㅋ태챠퍼ㅐ젇라ㅓㅣㅏ ㅁ~~~
            if (Inspection(_SrcImage, _InspRegion, _CogAutoPatternAlgo.ReferenceInfoList[0].Reference) == false)
            {
                return(_Result);
            }

            Run(_SrcImage, _InspRegion, _CogAutoPatternAlgo, ref _CogAutoPatternResult);

            return(_Result);
        }
Ejemplo n.º 26
0
 private void InitialTrainRegion()
 {
     this.cogDisplayTrain.InteractiveGraphics.Clear();
     if (_trainRegion == null)
     {
         _trainRegion = new CogRectangle();
         _trainRegion.SetCenterWidthHeight(this.cogDisplayTrain.Image.Width / 2,
                                           this.cogDisplayTrain.Image.Height / 2, this.cogDisplayTrain.Image.Width / 4, this.cogDisplayTrain.Image.Height / 4);
     }
     _trainRegion.Interactive      = true;
     _trainRegion.GraphicDOFEnable = CogRectangleDOFConstants.All;
     _trainRegion.MouseCursor      = CogStandardCursorConstants.ManipulableGraphic;
     this.cogDisplayTrain.InteractiveGraphics.Add(_trainRegion, "TrainRegion", false);
 }
Ejemplo n.º 27
0
        private void DrawReferRegionFunction(CogRectangle _ReferRegion, double _OriginX, double _OriginY, CogColorConstants _Color)
        {
            if (eTeachStep.ALGO_SET != CurrentTeachStep)
            {
                MessageBox.Show("Not select \"Algorithm Set\" button"); return;
            }
            AlgorithmAreaDisplayRefresh();

            CogPointMarker _PointMarker = new CogPointMarker();

            _PointMarker.SetCenterRotationSize(_OriginX, _OriginY, 0, 1);

            kpTeachDisplay.DrawInterActiveShape(_ReferRegion, "ReferRegion", _Color);
            kpTeachDisplay.DrawInterActiveShape(_PointMarker, "ReferOriginPoint", _Color, 14);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 수정이 불 가능한 고정 도형 그리기
        /// </summary>
        /// <param name="_cogRectAffine">RectAffine 객체</param>
        /// <param name="_groupName">그려지는 그룹명</param>
        /// <param name="_color">색상</param>
        public void DrawStaticShape(CogRectangle _cogRect, string _groupName, CogColorConstants _color, int _LineSize = 2)
        {
            StaticRectGraphic       = new CogRectangle();
            StaticRectGraphic       = _cogRect;
            StaticRectGraphic.Color = _color;
            StaticRectGraphic.LineWidthInScreenPixels = _LineSize;
            if (_groupName == "InspRegion" || _groupName == "AlgoRegion")
            {
                StaticRectGraphic.LineStyle = CogGraphicLineStyleConstants.Dash;
            }

            StaticRectGraphic.Selected = false;
            kCogDisplay.ClearDisplay(_groupName);
            kCogDisplay.StaticGraphics.Add(StaticRectGraphic.CopyBase(CogCopyShapeConstants.All), _groupName);
        }
Ejemplo n.º 29
0
        private void ShowPatternImageArea()
        {
            if (CogAutoPatternAlgoRcp.ReferenceInfoList.Count == 0)
            {
                return;
            }

            CogRectangle _Region = new CogRectangle();

            _Region.SetCenterWidthHeight(CogAutoPatternAlgoRcp.ReferenceInfoList[0].CenterX, CogAutoPatternAlgoRcp.ReferenceInfoList[0].CenterY, CogAutoPatternAlgoRcp.ReferenceInfoList[0].Width, CogAutoPatternAlgoRcp.ReferenceInfoList[0].Height);
            var _DrawReferRegionEvent = DrawReferRegionEvent;

            _DrawReferRegionEvent.Invoke(_Region,
                                         CogAutoPatternAlgoRcp.ReferenceInfoList[0].CenterX - CogAutoPatternAlgoRcp.ReferenceInfoList[0].OriginPointOffsetX,
                                         CogAutoPatternAlgoRcp.ReferenceInfoList[0].CenterY - CogAutoPatternAlgoRcp.ReferenceInfoList[0].OriginPointOffsetY, CogColorConstants.Yellow);
        }
Ejemplo n.º 30
0
        private void btnGateRemainingAreaSet_Click(object sender, EventArgs e)
        {
            #region Button Status Set
            btnGateRemainingAreaShow.Enabled = true;
            btnGateRemainingAreaSet.Enabled  = false;
            #endregion

            var          _GetRegionEvent = GetRegionEvent;
            CogRectangle _Region         = GetRegionEvent?.Invoke();

            var _DrawRegionEvent = DrawRegionEvent;
            _DrawRegionEvent?.Invoke(_Region, true);

            GateRemainingArea = new RectangleD();
            GateRemainingArea.SetCenterWidthHeight(_Region.CenterX, _Region.CenterY, _Region.Width, _Region.Height);
        }