コード例 #1
0
        public void ReadParam(string fileName)
        {
            NumLevels      = Convert.ToInt32(SetParam.ReadParam(fileName, "NumLevels", NumLevels.ToString()));
            mStartingAngle = Convert.ToSingle(SetParam.ReadParam(fileName, "AngleStart", mStartingAngle.ToString()));
            mAngleExtent   = Convert.ToSingle(SetParam.ReadParam(fileName, "AngleExtent", mAngleExtent.ToString()));
            AngleStep      = Convert.ToSingle(SetParam.ReadParam(fileName, "AngleStep", AngleStep.ToString()));
            Metric         = Convert.ToString(SetParam.ReadParam(fileName, "Metric", Metric.ToString()));
            MinScore       = Convert.ToSingle(SetParam.ReadParam(fileName, "MinScore", MinScore.ToString()));
            NumMatches     = Convert.ToInt32(SetParam.ReadParam(fileName, "NumMatches", NumMatches.ToString()));
            mMaxOverlap    = Convert.ToSingle(SetParam.ReadParam(fileName, "MaxOverlap", mMaxOverlap.ToString()));
            SubPixel       = Convert.ToString(SetParam.ReadParam(fileName, "SubPixel", SubPixel.ToString()));

            bool flag1 = Convert.ToBoolean(SetParam.ReadParam(fileName, "AutoNumLevels", IsAuto(AUTO_NUM_LEVEL).ToString()));

            if (flag1)
            {
                SetAuto(AUTO_NUM_LEVEL);
            }
            else
            {
                RemoveAuto(AUTO_NUM_LEVEL);
            }

            flag1 = Convert.ToBoolean(SetParam.ReadParam(fileName, "AutoNumLevels", IsAuto(AUTO_ANGLE_STEP).ToString()));
            if (flag1)
            {
                SetAuto(AUTO_ANGLE_STEP);
            }
            else
            {
                RemoveAuto(AUTO_ANGLE_STEP);
            }
        }
コード例 #2
0
        public void ReadHalconObj(string fileName)
        {
            if (File.Exists(fileName + ".ncm"))
            {
                if (nCCModel != null)
                {
                    nCCModel.Dispose();
                }

                nCCModel = new HNCCModel(fileName + ".ncm");
            }

            if (File.Exists(fileName + "se.tif"))
            {
                if (SearchRegion != null)
                {
                    SearchRegion.Dispose();
                }
                SearchRegion = new HRegion();
                SearchRegion.ReadRegion(fileName + "se.tif");
            }

            if (File.Exists(fileName + "md.tif"))
            {
                if (ModelRegion != null)
                {
                    ModelRegion.Dispose();
                }
                ModelRegion = new HRegion();
                ModelRegion.ReadRegion(fileName + "md.tif");
            }

            if (File.Exists(fileName + ".bmp"))
            {
                if (ModelImg != null)
                {
                    ModelImg.Dispose();
                }
                ModelImg = new HImage(fileName + ".bmp");
            }

            ModelImgRow   = Convert.ToSingle(SetParam.ReadParam(fileName, "ModelImgRow", ModelImgRow.ToString()));
            ModelImgCol   = Convert.ToSingle(SetParam.ReadParam(fileName, "ModelImgCol", ModelImgCol.ToString()));
            ModelimgAng   = Convert.ToSingle(SetParam.ReadParam(fileName, "ModelimgAng", ModelimgAng.ToString()));
            TimeOutEnable = Convert.ToBoolean(SetParam.ReadParam(fileName, "TimeOutEnable", TimeOutEnable.ToString()));
            OutTime       = Convert.ToInt32(SetParam.ReadParam(fileName, "OutTime", OutTime.ToString()));
            nCCParam.ReadParam(fileName + "par.dat");

            SetOutTime(TimeOutEnable ? 0 : OutTime);
        }