示例#1
0
        private bool Inspection(CogImage8Grey _SrcImage)
        {
            bool _Result = true;

            try
            {
                FindEllipseProc.InputImage = _SrcImage;
                FindEllipseProc.Run();
            }
            catch (System.Exception ex)
            {
                CLogManager.AddSystemLog(CLogManager.LOG_TYPE.ERR, "InspectionEllipseFind - Inspection Exception : " + ex.ToString(), CLogManager.LOG_LEVEL.LOW);
                _Result = false;
            }

            return(_Result);
        }
        public int Run(ADisplay aDisplay)
        {
            m_stResult.dX       = 0;
            m_stResult.dY       = 0;
            m_stResult.dRadiusX = 0;
            m_stResult.dRadiusY = 0;

            if (m_cogFindEllipseTool != null)
            {
                InputImage = aDisplay.Image;

                // 2015.04.08
                m_bRan = false;

                m_cogFindEllipseTool.Run();

                // 2015.04.08
                WaitRanEvent();

                m_stResult.nR = (int)m_cogFindEllipseTool.RunStatus.Result;
                if (m_stResult.nR == 0 && m_cogFindEllipseTool.Results.GetEllipse() != null)
                {
                    m_stResult.dX       = m_cogFindEllipseTool.Results.GetEllipse().CenterX;
                    m_stResult.dY       = m_cogFindEllipseTool.Results.GetEllipse().CenterY;
                    m_stResult.dRadiusX = m_cogFindEllipseTool.Results.GetEllipse().RadiusX;
                    m_stResult.dRadiusY = m_cogFindEllipseTool.Results.GetEllipse().RadiusY;
                }
                else
                {
                    m_stResult.nR = -2;
                }
            }
            else
            {
                m_stResult.nR = 2;
            }

            return(m_stResult.nR);
        }