Exemplo n.º 1
0
        public override bool Execute()
        {
            if (this.ImgData == null)
            {
                return(false);
            }

            if (this.IsUnStandard)
            {
                Inspection inspection = InspectionMgr.Instance.FindBy(InspectionKey);
                if (inspection == null)
                {
                    return(false);
                }
                inspection.Execute(this.ImgData, this.ImgWidth, this.ImgHeight);
                if (!inspection.IsCurrResultOk)
                {
                    return(false);
                }
                double x, y, x2, y2, angle;
                try
                {
                    string[] ss = inspection.CurrResultStr.Split(',');
                    x = double.Parse(ss[0]);
                    y = double.Parse(ss[1]);
                    if (this.UnStandardType == 0)
                    {
                        angle = double.Parse(ss[2]);
                        Angle = angle;
                    }
                    else
                    {
                        x2         = double.Parse(ss[2]);
                        y2         = double.Parse(ss[3]);
                        MarkInImg2 = new PointD(x2, y2);
                    }
                }
                catch
                {
                    return(false);
                }
                MarkInImg = new PointD(x, y);
            }
            else
            {
                double score = 0, x = 0, y = 0;
                int    rtn = ModelFindThm.Match(this.ImgData, this.ImgWidth, this.ImgHeight, this.ModelId, ref score, ref x, ref y);
                if (rtn != 0)
                {
                    return(false);
                }
                this.Score     = score;
                this.MarkInImg = new PointD(x, y);
                if (this.Score < this.AcceptScore)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        public override bool Init()
        {
            if (this.ModelData == null)
            {
                return(false);
            }

            int rtn = ModelFindThm.CreateModel(this.ModelData, this.ModelWidth, this.ModelHeight,
                                               this.SearchTopLeftX, this.SearchTopLeftY, this.SearchWidth, this.SearchHeight, ref this.ModelId);

            return(rtn == 0);
        }