Beispiel #1
0
        private bool SeraialReceiveEventFunction(string _SerialData)
        {
            string[]     ReceiveData = _SerialData.Split(',');
            eMainProcCmd ReceiveCmd  = eMainProcCmd.LOT_CHANGE;

            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, _SerialData, CLogManager.LOG_LEVEL.LOW);

            switch (ReceiveData[0])
            {
            case "@S": ReceiveCmd = eMainProcCmd.RCP_CHANGE; break;

            case "@L": ReceiveCmd = eMainProcCmd.LOT_CHANGE; break;

            case "@E": ReceiveCmd = eMainProcCmd.LOT_CHANGE; break;

            case "@N": ReceiveCmd = eMainProcCmd.LOT_CHANGE; break;
            }

            if (ReceiveCmd == eMainProcCmd.LOT_CHANGE)
            {
                OnMainProcessCommand(ReceiveCmd, _SerialData);
            }
            else
            {
                OnMainProcessCommand(ReceiveCmd, ReceiveData[1]);
            }

            return(true);
        }
Beispiel #2
0
        public void SaveAlgoRecipe()
        {
            CogBlobReferAlgoRcp.ForeGround              = Convert.ToInt32(graLabelForeground.Text);
            CogBlobReferAlgoRcp.ThresholdMin            = Convert.ToInt32(graLabelThresholdValue.Text);
            CogBlobReferAlgoRcp.BlobAreaMin             = Convert.ToDouble(textBoxBlobAreaMin.Text);
            CogBlobReferAlgoRcp.BlobAreaMax             = Convert.ToDouble(textBoxBlobAreaMax.Text);
            CogBlobReferAlgoRcp.Width                   = Convert.ToDouble(textBoxWidthSize.Text);
            CogBlobReferAlgoRcp.WidthPos                = Convert.ToDouble(textBoxWidthSpecPos.Text);
            CogBlobReferAlgoRcp.WidthNeg                = Convert.ToDouble(textBoxWidthSpecNeg.Text);
            CogBlobReferAlgoRcp.Height                  = Convert.ToDouble(textBoxHeightSize.Text);
            CogBlobReferAlgoRcp.HeightPos               = Convert.ToDouble(textBoxWidthSpecPos.Text);
            CogBlobReferAlgoRcp.HeightNeg               = Convert.ToDouble(textBoxWidthSpecNeg.Text);
            CogBlobReferAlgoRcp.BenchMarkPosition       = Convert.ToInt32(textBoxBenchMarkPosition.Text);
            CogBlobReferAlgoRcp.BodyArea                = Convert.ToDouble(textBoxBodyArea.Text);
            CogBlobReferAlgoRcp.BodyWidth               = Convert.ToDouble(textBoxBodyWidth.Text);
            CogBlobReferAlgoRcp.BodyHeight              = Convert.ToDouble(textBoxBodyHeight.Text);
            CogBlobReferAlgoRcp.BodyAreaPermitPercent   = Convert.ToDouble(numUpDownBodyArea.Value);
            CogBlobReferAlgoRcp.BodyWidthPermitPercent  = Convert.ToDouble(numUpDownBodyWidth.Value);
            CogBlobReferAlgoRcp.BodyHeightPermitPercent = Convert.ToDouble(numUpDownBodyHeight.Value);
            CogBlobReferAlgoRcp.DummyHistoMeanValue     = Convert.ToDouble(numUpDownDummyValue.Value);
            CogBlobReferAlgoRcp.UseBodyArea             = ckBodyArea.Checked;
            CogBlobReferAlgoRcp.UseBodyWidth            = ckBodyWidth.Checked;
            CogBlobReferAlgoRcp.UseBodyHeight           = ckBodyHeight.Checked;
            CogBlobReferAlgoRcp.UseDummyValue           = ckDummyUsable.Checked;
            CogBlobReferAlgoRcp.OriginX                 = OriginX;
            CogBlobReferAlgoRcp.OriginY                 = OriginY;

            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, "Teaching BlobReference SaveAlgoRecipe", CLogManager.LOG_LEVEL.MID);
        }
        private void ThreadInspectionFunction()
        {
            try
            {
                while (false == IsThreadInspectionExit)
                {
                    if (true == IsThreadInspectionTrigger)
                    {
                        IsThreadInspectionTrigger    = false;
                        InspWnd.IsInspectionComplete = false;
                        CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format("Vision : ISM{0} IsInspectionComplete false", ID + 1), CLogManager.LOG_LEVEL.LOW);

                        if (!IsSimulationMode)
                        {
                            ImageGrabSnap();
                        }
                        else
                        {
                            InspWnd.IsThreadInspectionProcessTrigger = true;
                        }

                        Thread.Sleep(50);
                    }

                    Thread.Sleep(10);
                }
            }

            catch (System.Exception ex)
            {
                CLogManager.AddSystemLog(CLogManager.LOG_TYPE.ERR, "ThreadInspectionFunction Exception : " + ex.ToString(), CLogManager.LOG_LEVEL.LOW);
            }
        }
        public void SaveAlgoRecipe()
        {
            CogLeadAlgoRcp.ForeGround   = Convert.ToInt32(graLabelForeground.Text);
            CogLeadAlgoRcp.ThresholdMin = Convert.ToInt32(graLabelThresholdValue.Text);
            CogLeadAlgoRcp.BlobAreaMin  = Convert.ToDouble(textBoxBlobAreaMin.Text);
            CogLeadAlgoRcp.BlobAreaMax  = Convert.ToDouble(textBoxBlobAreaMax.Text);
            CogLeadAlgoRcp.WidthMin     = Convert.ToDouble(textBoxWidthSizeMin.Text);
            CogLeadAlgoRcp.WidthMax     = Convert.ToDouble(textBoxWidthSizeMax.Text);
            CogLeadAlgoRcp.HeightMin    = Convert.ToDouble(textBoxHeightSizeMin.Text);
            CogLeadAlgoRcp.HeightMax    = Convert.ToDouble(textBoxHeightSizeMax.Text);

            CogLeadAlgoRcp.IsLeadBentInspection = ckLeadBent.Checked;
            CogLeadAlgoRcp.LeadBent             = Convert.ToDouble(textBoxLeadBentAngle.Text);
            CogLeadAlgoRcp.LeadBentMin          = Convert.ToDouble(textBoxLeadBentAngleMin.Text);
            CogLeadAlgoRcp.LeadBentMax          = Convert.ToDouble(textBoxLeadBentAngleMax.Text);

            CogLeadAlgoRcp.LeadCount = Convert.ToInt32(textBoxLeadCount.Text);

            CogLeadAlgoRcp.IsLeadPitchInspection = ckLeadPitch.Checked;
            CogLeadAlgoRcp.LeadPitch             = Convert.ToDouble(textBoxLeadPitch.Text);
            CogLeadAlgoRcp.LeadPitchMin          = Convert.ToDouble(textBoxLeadPitchMin.Text);
            CogLeadAlgoRcp.LeadPitchMax          = Convert.ToDouble(textBoxLeadPitchMax.Text);

            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, "Teaching LeadInspection SaveAlgoRecipe", CLogManager.LOG_LEVEL.MID);
        }
Beispiel #5
0
        //LDH, 2018.08.13, History 추가용 함수
        private void InspectionHistory(int _ID, string _Result)
        {
            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format("InspectionHistory Start"), CLogManager.LOG_LEVEL.LOW);

            DateTime dateTime           = DateTime.Now;
            string   InspScreenshotPath = @"D:\VisionInspectionData\CIPOSLeadInspection\HistoryData\Screenshot\";
            string   ImageSaveFolder    = String.Format("{0}{1:D4}\\{2:D2}\\{3:D2}", InspScreenshotPath, dateTime.Year, dateTime.Month, dateTime.Day);

            if (false == Directory.Exists(ImageSaveFolder))
            {
                Directory.CreateDirectory(ImageSaveFolder);
            }

            string ImageSaveFile;

            ImageSaveFile = String.Format("{0}\\{1:D2}{2:D2}{3:D2}{4:D3}.bmp", ImageSaveFolder, dateTime.Hour, dateTime.Minute, dateTime.Second, dateTime.Millisecond);

            //LDH, 2018.08.13, 프로젝트별로 DB에 해당하는 history 내역을 string 배열로 전달
            HistoryParam[0] = LastRecipeName;
            HistoryParam[1] = _ID.ToString();
            HistoryParam[2] = _Result;
            HistoryParam[3] = ImageSaveFile;

            CHistoryManager.AddHistory(HistoryParam);
            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format("InspectionHistory End"), CLogManager.LOG_LEVEL.LOW);

            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format("Screenshot Start"), CLogManager.LOG_LEVEL.LOW);
            var _ScreenshotEvent = ScreenshotEvent;

            _ScreenshotEvent?.Invoke(ImageSaveFile);
            //ScreenshotEvent(ImageSaveFile);
            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format("Screenshot End"), CLogManager.LOG_LEVEL.LOW);
        }
Beispiel #6
0
        public void SaveAlgoRecipe()
        {
            CogBarCodeIDAlgoRcp.Symbology = comboBoxSymbology.Text;
            CogBarCodeIDAlgoRcp.FindCount = Convert.ToInt32(numUpDownNumtoFind.Value);

            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, "Teaching CogID SaveAlgoRecipe", CLogManager.LOG_LEVEL.MID);
        }
Beispiel #7
0
        public void SaveAlgoRecipe()
        {
            CogAutoPatternAlgoRcp.MatchingScore    = Convert.ToDouble(numericUpDownFindScore.Value);
            CogAutoPatternAlgoRcp.MatchingCount    = 1;
            CogAutoPatternAlgoRcp.PatternThreshold = Convert.ToInt32(numericUpDownThreshold.Value);

            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, "Teaching CogPattern SaveAlgoRecipe", CLogManager.LOG_LEVEL.MID);
        }
Beispiel #8
0
        public void SaveAlgoRecipe()
        {
            CogMultiPatternAlgoRcp.MatchingScore = Convert.ToDouble(numericUpDownFindScore.Value);
            CogMultiPatternAlgoRcp.MatchingCount = Convert.ToInt32(numericUpDownFindCount.Value);
            CogMultiPatternAlgoRcp.MatchingAngle = Convert.ToDouble(numericUpDownAngleLimit.Value);
            CogMultiPatternAlgoRcp.PatternCount  = CogMultiPatternAlgoRcp.ReferenceInfoList.Count;
            CogMultiPatternAlgoRcp.TwoPointAngle = Convert.ToDouble(txtBoxAngle.Text);

            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, "Teaching CogPattern SaveAlgoRecipe", CLogManager.LOG_LEVEL.MID);
        }
Beispiel #9
0
 /// <summary>
 /// Display control 이미지 추가
 /// </summary>
 /// <param name="_cogDisplayImage">Display 할 이미지</param>
 public void SetDisplayImage(CogImage8Grey _cogDisplayImage)
 {
     try
     {
         SetDisplayInvoke(kCogDisplay, _cogDisplayImage);
     }
     catch
     {
         CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.ERR, "SetDisplayImage(CogImage8Grey) Exception!!", CLogManager.LOG_LEVEL.LOW);
     }
 }
        private void ImageGrabSnap()
        {
            //Camera 모듈 Check

            CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, String.Format("ISM {0} ImageGrabSnap Complete", ID + 1), CLogManager.LOG_LEVEL.LOW);
            CParameterManager.SystemMode = eSysMode.AUTO_MODE;
            InspWnd.GrabAndInspection();

            //InspWnd.IsThreadInspectionProcessTrigger = true;
            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format("ISM{0} IsThreadInspectionProcessTrigger = true", ID + 1), CLogManager.LOG_LEVEL.LOW);
        }
Beispiel #11
0
        public void SaveAlgoRecipe()
        {
            CogPatternAlgoRcp.MatchingScore = Convert.ToDouble(numericUpDownFindScore.Value);
            CogPatternAlgoRcp.MatchingCount = Convert.ToInt32(numericUpDownFindCount.Value);
            CogPatternAlgoRcp.MatchingAngle = Convert.ToDouble(numericUpDownAngleLimit.Value);
            CogPatternAlgoRcp.IsShift       = Convert.ToBoolean(checkBoxShift.Checked);
            CogPatternAlgoRcp.AllowedShiftX = Convert.ToDouble(numericUpDownAllowedShiftX.Value);
            CogPatternAlgoRcp.AllowedShiftY = Convert.ToDouble(numericUpDownAllowedShiftY.Value);
            CogPatternAlgoRcp.PatternCount  = CogPatternAlgoRcp.ReferenceInfoList.Count;

            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, "Teaching CogPattern SaveAlgoRecipe", CLogManager.LOG_LEVEL.MID);
        }
Beispiel #12
0
        private void ProcessingCallback(MC.SIGNALINFO signalInfo)
        {
            UInt32 currentChannel = (UInt32)signalInfo.Context;

            currentSurface = signalInfo.SignalInfo;

            // + GrablinkSnapshot Sample Program

            try
            {
                // Update the image with the acquired image buffer data
                Int32  width, height, bufferPitch;
                IntPtr bufferAddress;
                MC.GetParam(currentChannel, "ImageSizeX", out width);
                MC.GetParam(currentChannel, "ImageSizeY", out height);
                MC.GetParam(currentChannel, "BufferPitch", out bufferPitch);
                MC.GetParam(currentSurface, "SurfaceAddr", out bufferAddress);

                byte[] GrabImage = new byte[width * height];
                Marshal.Copy(bufferAddress, GrabImage, 0, GrabImage.Length);

                try
                {
                    imageMutex.WaitOne();

                    var _EuresysGrabEvent = EuresysGrabEvent;
                    _EuresysGrabEvent?.Invoke(GrabImage);
                }
                finally
                {
                    imageMutex.ReleaseMutex();
                }

                // Retrieve the frame rate
                Double frameRate_Hz;
                MC.GetParam(channel, "PerSecond_Fr", out frameRate_Hz);

                // Retrieve the channel state
                String channelState;
                MC.GetParam(channel, "ChannelState", out channelState);
            }
            catch (Euresys.MultiCamException exc)
            {
                CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.ERR, "cEuresysIOTAManager() ProcessingCallback Exception!! : MultiCanException", CLogManager.LOG_LEVEL.LOW);
            }
            catch (System.Exception exc)
            {
                CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.ERR, "cEuresysIOTAManager() System Exception!! : SystemException", CLogManager.LOG_LEVEL.LOW);
            }
            // - GrablinkSnapshot Sample Program
        }
Beispiel #13
0
        private void AcqFailureCallback(MC.SIGNALINFO signalInfo)
        {
            UInt32 currentChannel = (UInt32)signalInfo.Context;

            // + DominoSnapshot Sample Program

            try
            {
            }
            catch (System.Exception exc)
            {
                CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.ERR, "CEuresysManager AcqFailureCallback Exception!!", CLogManager.LOG_LEVEL.LOW);
            }
        }
        public void SetAlgoRecipe(Object _Algorithm, double _BenchMarkOffsetX, double _BenchMarkOffsetY, double _ResolutionX, double _ResolutionY)
        {
            if (_Algorithm != null)
            {
                AlgoInitFlag = false;

                CogLeadAlgoRcp = _Algorithm as CogLeadAlgo;

                ResolutionX      = _ResolutionX;
                ResolutionY      = _ResolutionY;
                BenchMarkOffsetX = _BenchMarkOffsetX;
                BenchMarkOffsetY = _BenchMarkOffsetY;

                LeadCount = CogLeadAlgoRcp.LeadCount;

                textBoxLeadCount.Text       = LeadCount.ToString();
                graLabelForeground.Text     = CogLeadAlgoRcp.ForeGround.ToString();
                graLabelThresholdValue.Text = CogLeadAlgoRcp.ThresholdMin.ToString();
                hScrollBarThreshold.Value   = CogLeadAlgoRcp.ThresholdMin;
                textBoxBlobAreaMin.Text     = CogLeadAlgoRcp.BlobAreaMin.ToString();
                textBoxBlobAreaMax.Text     = CogLeadAlgoRcp.BlobAreaMax.ToString();
                textBoxWidthSizeMin.Text    = CogLeadAlgoRcp.WidthMin.ToString();
                textBoxWidthSizeMax.Text    = CogLeadAlgoRcp.WidthMax.ToString();
                textBoxHeightSizeMin.Text   = CogLeadAlgoRcp.HeightMin.ToString();
                textBoxHeightSizeMax.Text   = CogLeadAlgoRcp.HeightMax.ToString();

                ckLeadBent.Checked           = CogLeadAlgoRcp.IsLeadBentInspection;
                textBoxLeadBentAngle.Text    = CogLeadAlgoRcp.LeadBent.ToString();
                textBoxLeadBentAngleMin.Text = CogLeadAlgoRcp.LeadBentMin.ToString();
                textBoxLeadBentAngleMax.Text = CogLeadAlgoRcp.LeadBentMax.ToString();

                ckLeadPitch.Checked      = CogLeadAlgoRcp.IsLeadPitchInspection;
                textBoxLeadPitch.Text    = CogLeadAlgoRcp.LeadPitch.ToString();
                textBoxLeadPitchMin.Text = CogLeadAlgoRcp.LeadPitchMin.ToString();
                textBoxLeadPitchMax.Text = CogLeadAlgoRcp.LeadPitchMax.ToString();

                SetForegroundComboBox(CogLeadAlgoRcp.ForeGround);
                SetLeadPanelAllStatus();

                AlgoInitFlag = true;
            }

            else
            {
                //LOG
                CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, "Teaching LeadInspection SetAlgoRecipe", CLogManager.LOG_LEVEL.MID);
            }
        }
Beispiel #15
0
        public void SaveAlgoRecipe()
        {
            CogLineFindAlgoRcp.CaliperNumber           = Convert.ToInt32(numUpDownCaliperNumber.Value);
            CogLineFindAlgoRcp.CaliperSearchLength     = Convert.ToInt32(numUpDownSearchLength.Value);
            CogLineFindAlgoRcp.CaliperProjectionLength = Convert.ToInt32(numUpDownProjectionLength.Value);
            CogLineFindAlgoRcp.CaliperSearchDirection  = Convert.ToInt32(graLabelSearchDirection.Text);
            CogLineFindAlgoRcp.IgnoreNumber            = Convert.ToInt32(numUpDownIgnoreNumber.Value);
            CogLineFindAlgoRcp.ContrastThreshold       = Convert.ToInt32(numUpDownContrastThreshold.Value);
            CogLineFindAlgoRcp.FilterHalfSizePixels    = Convert.ToInt32(numUpDownFilterHalfSizePixels.Value);
            CogLineFindAlgoRcp.CaliperLineStartX       = Convert.ToInt32(numUpDownStartX.Value);
            CogLineFindAlgoRcp.CaliperLineStartY       = Convert.ToInt32(numUpDownStartY.Value);
            CogLineFindAlgoRcp.CaliperLineEndX         = Convert.ToInt32(numUpDownEndX.Value);
            CogLineFindAlgoRcp.CaliperLineEndY         = Convert.ToInt32(numUpDownEndY.Value);
            CogLineFindAlgoRcp.UseAlignment            = ckUseAlignment.Checked;

            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, "Teaching CogLineFind SaveAlgoRecipe", CLogManager.LOG_LEVEL.MID);
        }
Beispiel #16
0
        public CEuresysIOTAManager(int _CamExposure = 1000)
        {
            try
            {
                // Open MultiCam driver
                MC.OpenDriver();

                // Enable error logging
                MC.SetParam(MC.CONFIGURATION, "ErrorLog", "error.log");


                MC.Create("CHANNEL", out channel);

                // Domino board 의 채널번호
                MC.SetParam(channel, "DriverIndex", 0);

                // Domino Iota Board는 'X' channel만 존재.
                MC.SetParam(channel, "Connector", "X");

                // camfile 을 불러온다
                //MC.SetParam(channel, "CamFile", "STC-A33A_P60SA");
                MC.SetParam(channel, "CamFile", "CV-A1_P16RA");

                // Sequence를 무제한으로 설정해야 Frame을 지속적으로 받을 수 있음.
                MC.SetParam(channel, "SeqLength_Fr", MC.INDETERMINATE);
                MC.SetParam(channel, "TrigMode", "HARD");
                MC.SetParam(channel, "TrigEdge", "GOLOW");
                //MC.SetParam(channel, "StrobeLevel", "PLSLOW");
                MC.SetParam(channel, "StrobeMode", "AUTO");

                // CallBack 함수등록
                multiCamCallback = new MC.CALLBACK(MultiCamCallback);
                MC.RegisterCallback(channel, multiCamCallback, channel);

                // 콜백 함수에 시크널 On 신호
                MC.SetParam(channel, MC.SignalEnable + MC.SIG_SURFACE_PROCESSING, "ON");
                MC.SetParam(channel, MC.SignalEnable + MC.SIG_ACQUISITION_FAILURE, "ON");
            }
            catch (Euresys.MultiCamException exc)
            {
                // An exception has occurred in the try {...} block.
                // Retrieve its description and display it in a message box.
                CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.ERR, "cEuresysIOTAManager() Exception!!", CLogManager.LOG_LEVEL.LOW);
            }
        }
Beispiel #17
0
        public int Initialize(string _DeviceName)
        {
            int iResult = (int)CDioConst.DIO_ERR_SUCCESS;

            try
            {
                iResult = ContecIOControl.Init(_DeviceName, out ID);
                if (iResult != (int)CDioConst.DIO_ERR_SUCCESS)
                {
                    InitializeDefaultMultiBit();
                }
            }
            catch
            {
                iResult = (int)CDioConst.DIO_ERR_INI_RESOURCE;
                CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.ERR, "CDIO Initialize Exception!!", CLogManager.LOG_LEVEL.LOW);
            }
            return(iResult);
        }
Beispiel #18
0
        private void ThreadContinuousGrabFunc()
        {
            try
            {
                while (false == IsThreadContinuousGrabExit)
                {
                    if (IsThreadContinuousGrabTrigger)
                    {
                        OneShot();
                    }
                    Thread.Sleep(25);
                }
            }

            catch
            {
                CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.ERR, "CBaslerManager ThreadContinuousGrabFunc Exception!!", CLogManager.LOG_LEVEL.LOW);
            }
        }
        private XmlNodeList GetNodeList(string _XmlFilePath)
        {
            XmlNodeList _XmlNodeList = null;

            try
            {
                XmlDocument _XmlDocument = new XmlDocument();
                _XmlDocument.Load(_XmlFilePath);
                XmlElement _XmlRoot = _XmlDocument.DocumentElement;
                _XmlNodeList = _XmlRoot.ChildNodes;
            }

            catch
            {
                _XmlNodeList = null;
                CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.ERR, "DIOControlWindow GetNodeList Exception!!", CLogManager.LOG_LEVEL.LOW);
            }

            return(_XmlNodeList);
        }
        public void SaveAlgoRecipe()
        {
            CogNeedleFindAlgoRcp.CaliperNumber           = Convert.ToInt32(numUpDownCaliperNumber.Value);
            CogNeedleFindAlgoRcp.CaliperSearchLength     = Convert.ToDouble(numUpDownSearchLength.Value);
            CogNeedleFindAlgoRcp.CaliperProjectionLength = Convert.ToDouble(numUpDownProjectionLength.Value);
            CogNeedleFindAlgoRcp.CaliperSearchDirection  = Convert.ToInt32(graLabelSearchDirection.Text);
            CogNeedleFindAlgoRcp.CaliperIgnoreNumber     = Convert.ToInt32(numUpDownIgnoreNumber.Value);
            CogNeedleFindAlgoRcp.CaliperPolarity         = Convert.ToInt32(graLabelPolarity.Text);
            CogNeedleFindAlgoRcp.ArcCenterX    = Convert.ToDouble(numUpDownArcCenterX.Value) + BenchMarkOffsetX;
            CogNeedleFindAlgoRcp.ArcCenterY    = Convert.ToDouble(numUpDownArcCenterY.Value) + BenchMarkOffsetY;
            CogNeedleFindAlgoRcp.ArcRadius     = Convert.ToDouble(numUpDownArcRadius.Value);
            CogNeedleFindAlgoRcp.ArcAngleStart = Convert.ToDouble(numUpDownAngleStart.Value);
            CogNeedleFindAlgoRcp.ArcAngleSpan  = Convert.ToDouble(numUpDownAngleSpan.Value);
            //CogNeedleFindAlgoRcp.OriginX        = Convert.ToDouble(textBoxCenterX.Text) / ResolutionX;
            //CogNeedleFindAlgoRcp.OriginY        = Convert.ToDouble(textBoxCenterY.Text) / ResolutionY;
            CogNeedleFindAlgoRcp.OriginX      = OriginX;
            CogNeedleFindAlgoRcp.OriginY      = OriginY;
            CogNeedleFindAlgoRcp.OriginRadius = Convert.ToDouble(textBoxRadius.Text);

            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, "Teaching NeedleCircleFind SaveAlgoRecipe", CLogManager.LOG_LEVEL.MID);
        }
Beispiel #21
0
        public void SetDisplayImage(byte[] _DisplayImageArray, int _Width, double _Height)
        {
            try
            {
                UInt32 _BuffSize  = (UInt32)(_Width * _Height);
                byte[] _ImageBuff = new byte[_BuffSize];
                _ImageBuff = _DisplayImageArray;
                Bitmap     _Bitmap = new Bitmap(_Width, (int)_Height, PixelFormat.Format8bppIndexed);
                BitmapData bmpData = _Bitmap.LockBits(new Rectangle(0, 0, _Bitmap.Width, _Bitmap.Height), ImageLockMode.WriteOnly, _Bitmap.PixelFormat);
                Marshal.Copy(_ImageBuff, 0, bmpData.Scan0, _ImageBuff.Length);
                _Bitmap.UnlockBits(bmpData);

                var _CogImage = new CogImage8Grey(_Bitmap);
                SetDisplayInvoke(kCogDisplay, _CogImage);
                GC.Collect();
            }
            catch
            {
                CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.ERR, "SetDisplayImage(byte[]) Exception!!", CLogManager.LOG_LEVEL.LOW);
            }
        }
Beispiel #22
0
        /// <summary>
        /// LDH, 2017.06.04
        /// 현재 Display된 Image 저장하기
        /// </summary>
        public void SaveDisplayImage(string _DirectoryPath)
        {
            DateTime dateTime        = DateTime.Now;
            string   ImageSaveFolder = _DirectoryPath;

            if (false == Directory.Exists(ImageSaveFolder))
            {
                Directory.CreateDirectory(ImageSaveFolder);
            }
            ImageSaveFolder = String.Format("{0}\\{1:D4}\\{2:D2}\\{3:D2}", ImageSaveFolder, dateTime.Year, dateTime.Month, dateTime.Day);
            if (false == Directory.Exists(ImageSaveFolder))
            {
                Directory.CreateDirectory(ImageSaveFolder);
            }

            string ImageSaveFile;

            ImageSaveFile = String.Format("{0}\\{1:D2}{2:D2}{3:D2}{4:D3}.bmp", ImageSaveFolder, dateTime.Hour, dateTime.Minute, dateTime.Second, dateTime.Millisecond);

            try
            {
                ICogImage    _CogSaveImage = kCogDisplay.Image;
                CogImageFile _CogImageFile = new CogImageFile();

                if (_CogSaveImage == null)
                {
                    //MessageBox.Show(new Form{TopMost = true}, "영상이 없습니다.");
                }
                else
                {
                    _CogImageFile.Open(ImageSaveFile, CogImageFileModeConstants.Write);
                    _CogImageFile.Append(_CogSaveImage);
                    _CogImageFile.Close();
                }
            }
            catch
            {
                CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.ERR, "SetDisplayImage(string) Exception!!", CLogManager.LOG_LEVEL.LOW);
            }
        }
Beispiel #23
0
        public void SaveAlgoRecipe()
        {
            if (textBoxCenterX.Text == "-")
            {
                MessageBox.Show("Check Ellipse CenterX"); return;
            }
            else if (textBoxCenterY.Text == "-")
            {
                MessageBox.Show("Check Ellipse CenterY"); return;
            }
            else if (textBoxRadiusX.Text == "-")
            {
                MessageBox.Show("Check Ellipse RadiusX"); return;
            }
            else if (textBoxRadiusY.Text == "-")
            {
                MessageBox.Show("Check Ellipse RadiusY"); return;
            }

            CogEllipseAlgoRcp.CaliperNumber           = Convert.ToInt32(numUpDownCaliperNumber.Value) * 2;
            CogEllipseAlgoRcp.CaliperSearchLength     = Convert.ToDouble(numUpDownSearchLength.Value);
            CogEllipseAlgoRcp.CaliperProjectionLength = Convert.ToDouble(numUpDownProjectionLength.Value);
            CogEllipseAlgoRcp.CaliperSearchDirection  = Convert.ToInt32(graLabelSearchDirection.Text);
            CogEllipseAlgoRcp.CaliperIgnoreNumber     = Convert.ToInt32(numUpDownIgnoreNumber.Value);
            CogEllipseAlgoRcp.CaliperPolarity         = Convert.ToInt32(graLabelPolarity.Text);
            CogEllipseAlgoRcp.ArcCenterX    = Convert.ToDouble(numUpDownArcCenterX.Value) + BenchMarkOffsetX;
            CogEllipseAlgoRcp.ArcCenterY    = Convert.ToDouble(numUpDownArcCenterY.Value) + BenchMarkOffsetY;
            CogEllipseAlgoRcp.ArcRadiusX    = Convert.ToDouble(numUpDownArcRadiusX.Value);
            CogEllipseAlgoRcp.ArcRadiusY    = Convert.ToDouble(numUpDownArcRadiusY.Value);
            CogEllipseAlgoRcp.ArcAngleSpan  = Convert.ToDouble(numUpDownAngleSpan.Value);
            CogEllipseAlgoRcp.OriginX       = OriginX;
            CogEllipseAlgoRcp.OriginY       = OriginY;
            CogEllipseAlgoRcp.OriginRadiusX = Convert.ToDouble(textBoxRadiusX.Text);
            CogEllipseAlgoRcp.OriginRadiusY = Convert.ToDouble(textBoxRadiusY.Text);
            CogEllipseAlgoRcp.DiameterSize  = Convert.ToDouble(numUpDownDiameterSize.Text);
            CogEllipseAlgoRcp.DiameterPlus  = Convert.ToDouble(numUpDownDiameterPlus.Text);
            CogEllipseAlgoRcp.DiameterMinus = Convert.ToDouble(numUpDownDiameterMinus.Text);

            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, "Teaching EllipseFind SaveAlgoRecipe", CLogManager.LOG_LEVEL.MID);
        }
Beispiel #24
0
        //LDH, 2018.08.20, Serial Data Send
        public override void SendSerialData(eMainProcCmd _SendCmd, string _SendData = "")
        {
            string SendBit = "";

            switch (_SendCmd)
            {
            case eMainProcCmd.RCP_CHANGE: SendBit = "@D_OK"; break;

            case eMainProcCmd.LOT_CHANGE:
            {
                if (_SendData == "RELOAD")
                {
                    SendBit = "@N_OK";
                }
                if (_SendData == "END")
                {
                    SendBit = "@E_OK";
                }
                //else                         SendBit = "@L_OK";
            } break;

            case eMainProcCmd.REQUEST:
            {
                if (_SendData == "LOT")
                {
                    SendBit = "@R_L";
                }
                else
                {
                    SendBit = "@R_D";
                }
            }
            break;

            case eMainProcCmd.LOT_RETURN: SendBit = string.Format("@L_OK,{0}", _SendData); break;
            }

            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, SendBit + "," + '\r', CLogManager.LOG_LEVEL.LOW);
            SerialWnd.SendSequenceData(SendBit + "," + '\r');
        }
Beispiel #25
0
        public void SetDisplayImage(byte[] _DisplayImageArray, int _Width, int _Height)
        {
            try
            {
                var _Buffer = new SafeMalloc(_Width * _Height);
                Marshal.Copy(_DisplayImageArray, 0, _Buffer, _Width * _Height);

                var cogRoot = new CogImage8Root();
                cogRoot.Initialize(_Width, _Height, _Buffer, _Width, _Buffer);

                var _CogImage = new CogImage8Grey();
                _CogImage.SetRoot(cogRoot);
                //ICogImage InspectionImage = (ICogImage)_CogImage;

                SetDisplayInvoke(kCogDisplay, _CogImage);
                GC.Collect();
            }
            catch
            {
                CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.ERR, "SetDisplayImage(byte[]) Exception!!", CLogManager.LOG_LEVEL.LOW);
            }
        }
Beispiel #26
0
        public void SaveAlgoRecipe()
        {
            CogLineFindAlgo _CogLineFindAlgoRcp = new CogLineFindAlgo();

            _CogLineFindAlgoRcp.CaliperNumber           = Convert.ToInt32(numUpDownCaliperNumber.Value);
            _CogLineFindAlgoRcp.CaliperSearchLength     = Convert.ToDouble(numUpDownSearchLength.Value);
            _CogLineFindAlgoRcp.CaliperProjectionLength = Convert.ToDouble(numUpDownProjectionLength.Value);
            _CogLineFindAlgoRcp.CaliperSearchDirection  = Convert.ToInt32(graLabelSearchDirection.Text);
            _CogLineFindAlgoRcp.IgnoreNumber            = Convert.ToInt32(numUpDownIgnoreNumber.Text);
            _CogLineFindAlgoRcp.ContrastThreshold       = Convert.ToInt32(numUpDownContrastThreshold.Value);
            _CogLineFindAlgoRcp.FilterHalfSizePixels    = Convert.ToInt32(numUpDownFilterHalfSizePixels.Value);
            _CogLineFindAlgoRcp.CaliperLineStartX       = Convert.ToDouble(numUpDownStartX.Value);
            _CogLineFindAlgoRcp.CaliperLineStartY       = Convert.ToDouble(numUpDownStartY.Value);
            _CogLineFindAlgoRcp.CaliperLineEndX         = Convert.ToDouble(numUpDownEndX.Value);
            _CogLineFindAlgoRcp.CaliperLineEndY         = Convert.ToDouble(numUpDownEndY.Value);

            var  _CheckCaliperStatusEvent = CheckCaliperStatusEvent;
            bool?_Result = _CheckCaliperStatusEvent?.Invoke(_CogLineFindAlgoRcp);

            if (true == _Result)
            {
                CogLineFindAlgoRcp.CaliperNumber           = Convert.ToInt32(numUpDownCaliperNumber.Value);
                CogLineFindAlgoRcp.CaliperSearchLength     = Convert.ToInt32(numUpDownSearchLength.Value);
                CogLineFindAlgoRcp.CaliperProjectionLength = Convert.ToInt32(numUpDownProjectionLength.Value);
                CogLineFindAlgoRcp.CaliperSearchDirection  = Convert.ToInt32(graLabelSearchDirection.Text);
                CogLineFindAlgoRcp.IgnoreNumber            = Convert.ToInt32(numUpDownIgnoreNumber.Value);
                CogLineFindAlgoRcp.ContrastThreshold       = Convert.ToInt32(numUpDownContrastThreshold.Value);
                CogLineFindAlgoRcp.FilterHalfSizePixels    = Convert.ToInt32(numUpDownFilterHalfSizePixels.Value);
                CogLineFindAlgoRcp.CaliperLineStartX       = Convert.ToInt32(numUpDownStartX.Value);
                CogLineFindAlgoRcp.CaliperLineStartY       = Convert.ToInt32(numUpDownStartY.Value);
                CogLineFindAlgoRcp.CaliperLineEndX         = Convert.ToInt32(numUpDownEndX.Value);
                CogLineFindAlgoRcp.CaliperLineEndY         = Convert.ToInt32(numUpDownEndY.Value);
                CogLineFindAlgoRcp.UseAlignment            = ckUseAlignment.Checked;

                CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, "Teaching CogLineFind SaveAlgoRecipe", CLogManager.LOG_LEVEL.MID);
            }
        }
Beispiel #27
0
 protected void OnContextMenuItemLoadImageClicked(object sender, EventArgs e)
 {
     using (OpenFileDialog _openFileDialog = new OpenFileDialog())
     {
         _openFileDialog.Filter = "BmpFile (*.bmp)|*.bmp";
         try
         {
             if (_openFileDialog.ShowDialog() == DialogResult.OK)
             {
                 string           _fileName         = _openFileDialog.FileName;
                 CogImageFileTool _cogImageFileTool = new CogImageFileTool();
                 _cogImageFileTool.Operator.Open(_fileName, CogImageFileModeConstants.Read);
                 _cogImageFileTool.Run();
                 this.Image   = _cogImageFileTool.OutputImage;
                 this.AutoFit = true;
             }
         }
         catch
         {
             CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.ERR, "OnContextMenuItemLoadImageClicked Exception!!", CLogManager.LOG_LEVEL.LOW);
             MessageBox.Show("Loading image failed.");
         }
     }
 }
Beispiel #28
0
        public void SetNeedleResultData(SendResultParameter _ResultParam)
        {
            if (_ResultParam.ID == 0)   //Needle Align Vision1
            {
                var _Result = _ResultParam.SendResult as SendNeedleAlignResult;
                if (_Result != null)
                {
                    ControlInvoke.GradientLabelText(gradientLabelNeedleAlignX1, _Result.AlignX.ToString("F3"));
                    ControlInvoke.GradientLabelText(gradientLabelNeedleAlignY1, _Result.AlignY.ToString("F3"));
                }
                else
                {
                    ControlInvoke.GradientLabelText(gradientLabelNeedleAlignX1, "-");
                    ControlInvoke.GradientLabelText(gradientLabelNeedleAlignY1, "-");
                }

                if (_ResultParam.IsGood)
                {
                    LastResult = "GOOD";
                    ControlInvoke.GradientLabelText(gradientLabelNeedleAlignX1, Color.Black, Color.White);
                    ControlInvoke.GradientLabelText(gradientLabelNeedleAlignY1, Color.Black, Color.White);
                    ControlInvoke.GradientLabelText(gradientLabelResult, "GOOD", Color.Lime);
                }

                else
                {
                    if (eNgType.NDL_FIND == _ResultParam.NgType)
                    {
                        LastResult = "Not Found";
                    }

                    else if (eNgType.NDL_CENTER == _ResultParam.NgType)
                    {
                        LastResult = "Not Found";
                    }

                    ControlInvoke.GradientLabelText(gradientLabelNeedleAlignX1, Color.White, Color.Red);
                    ControlInvoke.GradientLabelText(gradientLabelNeedleAlignY1, Color.White, Color.Red);
                    ControlInvoke.GradientLabelText(gradientLabelResult, "Not Found", Color.Red);
                }
            }

            else if (_ResultParam.ID == 1)   //Needle Align Vision2
            {
                var _Result = _ResultParam.SendResult as SendNeedleAlignResult;
                if (_Result != null)
                {
                    ControlInvoke.GradientLabelText(gradientLabelNeedleAlignX2, _Result.AlignX.ToString("F3"));
                    ControlInvoke.GradientLabelText(gradientLabelNeedleAlignY2, _Result.AlignY.ToString("F3"));
                }
                else
                {
                    ControlInvoke.GradientLabelText(gradientLabelNeedleAlignX2, "-");
                    ControlInvoke.GradientLabelText(gradientLabelNeedleAlignY2, "-");
                }

                if (_ResultParam.IsGood)
                {
                    LastResult = "GOOD";
                    ControlInvoke.GradientLabelText(gradientLabelNeedleAlignX2, Color.Black, Color.White);
                    ControlInvoke.GradientLabelText(gradientLabelNeedleAlignY2, Color.Black, Color.White);
                    ControlInvoke.GradientLabelText(gradientLabelResult, "GOOD", Color.Lime);
                }

                else
                {
                    if (eNgType.NDL_FIND == _ResultParam.NgType)
                    {
                        LastResult = "Not Found";
                    }

                    else if (eNgType.NDL_CENTER == _ResultParam.NgType)
                    {
                        LastResult = "Not Found";
                    }

                    ControlInvoke.GradientLabelText(gradientLabelNeedleAlignX2, Color.White, Color.Red);
                    ControlInvoke.GradientLabelText(gradientLabelNeedleAlignY2, Color.White, Color.Red);
                    ControlInvoke.GradientLabelText(gradientLabelResult, "Not Found", Color.Red);
                }
            }

            else
            {
                //LOG
                CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, "ucMainResultLead - SetNeedleData ID Match Error", CLogManager.LOG_LEVEL.LOW);
            }

            InspectionHistory(_ResultParam.ID, LastResult);
        }
Beispiel #29
0
        public CEuresysManager(string _CamInfo = "VCC-G20S20_P15RA", int _CamExposure = 1000)
        {
            try
            {
                // Open MultiCam driver
                MC.OpenDriver();

                // Enable error logging
                MC.SetParam(MC.CONFIGURATION, "ErrorLog", "error.log");

                // Create a channel and associate it with the first connector on the first board
                MC.Create("CHANNEL", out channel);
                MC.SetParam(channel, "DriverIndex", 0);
                // For all Domino boards except Domino Symphony
                MC.SetParam(channel, "Connector", "X");
                // For Domino Symphony
                //MC.SetParam(channel, "Connector", "A");

                // Choose the CAM file
                //MC.SetParam(channel, "CamFile", "XC-HR50_P60RA");
                //MC.SetParam(channel, "CamFile", "VCC-G20S20_P15RA");
                //MC.SetParam(channel, "CamFile", "CV-A1_P16RA");

                if (_CamInfo == "")
                {
                    _CamInfo = "VCC-G20S20_P15RA";
                }
                MC.SetParam(channel, "CamFile", _CamInfo);
                // Choose the camera expose duration
                MC.SetParam(channel, "Expose_us", _CamExposure);
                // Choose the pixel color format
                MC.SetParam(channel, "ColorFormat", "Y8");

                // Choose the way the first acquisition is triggered
                //MC.SetParam(channel, "TrigMode", "IMMEDIATE");
                MC.SetParam(channel, "TrigMode", "HARD");
                // Choose the triggering mode for subsequent acquisitions
                //MC.SetParam(channel, "NextTrigMode", "REPEAT");
                MC.SetParam(channel, "NextTrigMode", "SAME");
                // Choose the number of images to acquire

                //MC.SetParam(channel, "TrigLine", "NOM");
                //MC.SetParam(channel, "TrigEdge", "GOHIGH");
                //MC.SetParam(channel, "TrigFilter", "ON");
                //MC.SetParam(channel, "TrigCtl", "LVDS");

                MC.SetParam(channel, "TrigCtl", "TTL");
                MC.SetParam(channel, "TrigLine", "NOM");
                MC.SetParam(channel, "TrigEdge", "GOLOW");
                MC.SetParam(channel, "TrigFilter", "ON");

                MC.SetParam(channel, "StrobeCtl", "OPTO");
                //MC.SetParam(channel, "StrobeCtl", "TTL");
                MC.SetParam(channel, "StrobeMode", "AUTO");
                MC.SetParam(channel, "StrobeLevel", "PLSLOW");

                //MC.SetParam(channel, "SeqLength_Fr", MC.INDETERMINATE);
                MC.SetParam(channel, "SeqLength_Fr", -1);

                // Register the callback function
                multiCamCallback = new MC.CALLBACK(MultiCamCallback);
                MC.RegisterCallback(channel, multiCamCallback, channel);

                // Enable the signals corresponding to the callback functions
                MC.SetParam(channel, MC.SignalEnable + MC.SIG_SURFACE_PROCESSING, "ON");
                MC.SetParam(channel, MC.SignalEnable + MC.SIG_ACQUISITION_FAILURE, "ON");

                // Prepare the channel in order to minimize the acquisition sequence startup latency
                MC.SetParam(channel, "ChannelState", "READY");
                MC.SetParam(channel, "ChannelState", "ACTIVE");
            }

            catch (Euresys.MultiCamException ex)
            {
                CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.ERR, "cEuresysManager() Exception!!", CLogManager.LOG_LEVEL.LOW);
            }
        }
        public bool Run(CogImage8Grey _SrcImage, CogRectangle _InspRegion, CogPatternAlgo _CogPatternAlgo, ref CogPatternResult _CogPatternResult)
        {
            bool _Result = false;

            if (_CogPatternAlgo.ReferenceInfoList.Count > 0)
            {
                //LDH, 2019.01.04, Score 80%로 설정
                double _MinMatchingScore = _CogPatternAlgo.MatchingScore * 0.8;

                PatternProc.RunParams.AcceptThreshold         = _MinMatchingScore / 100;
                PatternProc.RunParams.ApproximateNumberToFind = _CogPatternAlgo.MatchingCount;
                PatternProc.RunParams.ZoneAngle.Configuration = CogPMAlignZoneConstants.LowHigh;
                PatternProc.RunParams.ZoneAngle.Low           = _CogPatternAlgo.MatchingAngle * -1 * Math.PI / 180;
                PatternProc.RunParams.ZoneAngle.High          = _CogPatternAlgo.MatchingAngle * 1 * Math.PI / 180;

                for (int iLoopCount = 0; iLoopCount < _CogPatternAlgo.ReferenceInfoList.Count; ++iLoopCount)
                {
                    List <int> _PatternIndexList = new List <int>();

                    if (false == Inspection(_SrcImage, _InspRegion, _CogPatternAlgo.ReferenceInfoList[iLoopCount].Reference))
                    {
                        continue;
                    }

                    if (PatternResults != null && PatternResults.Count > 0)
                    {
                        CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - Find Count : " + PatternResults.Count.ToString(), CLogManager.LOG_LEVEL.MID);

                        _CogPatternResult.FindCount = 0;
                        for (int jLoopCount = 0; jLoopCount < PatternResults.Count; ++jLoopCount)
                        {
                            if (PatternResults[jLoopCount].Score * 100 >= _MinMatchingScore)
                            {
                                _CogPatternResult.FindCount++;

                                //LDH, 2019.01.04, Score 순서로 Index 정렬
                                if (_PatternIndexList.Count == 0 || PatternResults[jLoopCount].Score <= PatternResults[_PatternIndexList[0]].Score)
                                {
                                    _PatternIndexList.Add(jLoopCount);
                                }
                                else
                                {
                                    _PatternIndexList.Insert(0, jLoopCount);
                                }
                            }
                        }

                        if (_CogPatternResult.FindCount > _CogPatternAlgo.MatchingCount)
                        {
                            _CogPatternResult.FindCount = _CogPatternAlgo.MatchingCount;
                        }

                        if (_CogPatternResult.FindCount > 0)
                        {
                            _CogPatternResult.Score        = new double[_CogPatternResult.FindCount];
                            _CogPatternResult.Scale        = new double[_CogPatternResult.FindCount];
                            _CogPatternResult.Angle        = new double[_CogPatternResult.FindCount];
                            _CogPatternResult.CenterX      = new double[_CogPatternResult.FindCount];
                            _CogPatternResult.CenterY      = new double[_CogPatternResult.FindCount];
                            _CogPatternResult.OriginPointX = new double[_CogPatternResult.FindCount];
                            _CogPatternResult.OriginPointY = new double[_CogPatternResult.FindCount];
                            _CogPatternResult.Width        = new double[_CogPatternResult.FindCount];
                            _CogPatternResult.Height       = new double[_CogPatternResult.FindCount];
                            _CogPatternResult.IsGoods      = new bool[_CogPatternResult.FindCount];

                            _CogPatternResult.IsGood = false;

                            //int _Index = 0;
                            for (int jLoopCount = 0; jLoopCount < _CogPatternResult.FindCount; ++jLoopCount)
                            {
                                //if (PatternResults[jLoopCount].Score * 100 >= _CogPatternAlgo.MatchingScore)
                                if (PatternResults[jLoopCount].Score * 100 >= _MinMatchingScore)
                                {
                                    _CogPatternResult.Score[jLoopCount]        = PatternResults[_PatternIndexList[jLoopCount]].Score;
                                    _CogPatternResult.Scale[jLoopCount]        = PatternResults[_PatternIndexList[jLoopCount]].GetPose().Scaling;
                                    _CogPatternResult.Angle[jLoopCount]        = PatternResults[_PatternIndexList[jLoopCount]].GetPose().Rotation;
                                    _CogPatternResult.OriginPointX[jLoopCount] = PatternResults[_PatternIndexList[jLoopCount]].GetPose().TranslationX;
                                    _CogPatternResult.OriginPointY[jLoopCount] = PatternResults[_PatternIndexList[jLoopCount]].GetPose().TranslationY;
                                    _CogPatternResult.CenterX[jLoopCount]      = _CogPatternResult.OriginPointX[_PatternIndexList[jLoopCount]] + _CogPatternAlgo.ReferenceInfoList[iLoopCount].OriginPointOffsetX;
                                    _CogPatternResult.CenterY[jLoopCount]      = _CogPatternResult.OriginPointY[_PatternIndexList[jLoopCount]] + _CogPatternAlgo.ReferenceInfoList[iLoopCount].OriginPointOffsetY;
                                    _CogPatternResult.Width[jLoopCount]        = _CogPatternAlgo.ReferenceInfoList[iLoopCount].Width;
                                    _CogPatternResult.Height[jLoopCount]       = _CogPatternAlgo.ReferenceInfoList[iLoopCount].Height;
                                    //_Index++;

                                    if (PatternResults[_PatternIndexList[jLoopCount]].Score * 100 >= _CogPatternAlgo.MatchingScore)
                                    {
                                        _CogPatternResult.IsGood = true;
                                        _CogPatternResult.IsGoods[jLoopCount] = true;
                                    }
                                    else
                                    {
                                        _CogPatternResult.IsGoods[jLoopCount] = false;
                                    }

                                    CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - Find Score : " + (_CogPatternResult.Score[jLoopCount] * 100).ToString("F2"), CLogManager.LOG_LEVEL.MID);
                                }
                            }

                            //_CogPatternResult.IsGood = true;
                            break;
                        }

                        else
                        {
                            _CogPatternResult.IsGood = false;
                        }
                    }

                    else
                    {
                        _CogPatternResult.IsGood = false;
                    }
                }
            }

            else
            {
                _CogPatternResult.IsGood = false;
            }

            if (0 == _CogPatternResult.FindCount)
            {
                _CogPatternResult.Score        = new double[1];
                _CogPatternResult.Scale        = new double[1];
                _CogPatternResult.Angle        = new double[1];
                _CogPatternResult.CenterX      = new double[1];
                _CogPatternResult.CenterY      = new double[1];
                _CogPatternResult.OriginPointX = new double[1];
                _CogPatternResult.OriginPointY = new double[1];
                _CogPatternResult.Width        = new double[1];
                _CogPatternResult.Height       = new double[1];

                _CogPatternResult.Score[0]        = 0;
                _CogPatternResult.Scale[0]        = 0;
                _CogPatternResult.Angle[0]        = 0;
                _CogPatternResult.OriginPointX[0] = _InspRegion.CenterX;
                _CogPatternResult.OriginPointY[0] = _InspRegion.CenterY;
                _CogPatternResult.CenterX[0]      = _InspRegion.CenterX;
                _CogPatternResult.CenterY[0]      = _InspRegion.CenterY;
                _CogPatternResult.Width[0]        = _InspRegion.Width;
                _CogPatternResult.Height[0]       = _InspRegion.Height;
            }

            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, " - Result : " + (_CogPatternResult.IsGood).ToString(), CLogManager.LOG_LEVEL.MID);

            return(_Result);
        }