示例#1
0
        public override object Read()
        {
            try
            {
                VisionFitCircleParam tempvisionFitCircleParam = null;
                string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";
                //tempvisionFitCircleParam = (VisionFitCircleParam)AccessXmlSerializer.XmlToObject(strPath, visionFitCircleParam.GetType());
                strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".json";
                VisionFitCircircle fitCircircle = (VisionFitCircircle)AccessJosnSerializer.JsonToObject(strPath, this.GetType());
                if (fitCircircle != null && fitCircircle.visionFitCircleParam != null)
                {
                    visionFitCircleParam = tempvisionFitCircleParam = fitCircircle.visionFitCircleParam;
                }
                else
                {
                    _logger.Warn(m_strStepName + ": 视觉处理项目加载失败,请检查");
                    MessageBox.Show(m_strStepName + ": 视觉处理项目加载失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(null);
                }
                return(visionFitCircleParam);

                //object obj = new object();
                //string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".json";
                //AccessJosnSerializer.ObjectToJson(strPath,obj);
            }
            catch (Exception e)
            {
                _logger.Warn(m_strStepName + "读取失败:" + e.Message);
            }
            return(null);
        }
示例#2
0
        public override bool GenObj(HObject image, VisionControl visionControl)
        {
            try
            {
                if (Mode2dCode != null)
                {
                    HOperatorSet.ClearDataCode2dModel(Mode2dCode);
                }
                HTuple hv_DataCodeHandleLow = null;
                HOperatorSet.CreateDataCode2dModel(vision2dCodeParam.Code2dSystem, "default_parameters", "standard_recognition", out hv_DataCodeHandleLow);

                Mode2dCode = hv_DataCodeHandleLow;

                string Mode2dcodePath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + "_data_code_model.dcm";
                HOperatorSet.WriteDataCode2dModel(Mode2dCode, Mode2dcodePath);

                string imgpath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".bmp";
                if (image != null && image.IsInitialized())
                {
                    HOperatorSet.WriteImage(image, "bmp", 0, imgpath);
                }
            }
            catch (HalconException e)
            {
                MessageBox.Show(m_strStepName + "创建2CodeModle失败:" + e.Message, "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            return(true);
        }
示例#3
0
        public void Read()
        {
            string strVisionConfigPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "VisionMgr" + ".xml";

            if (VisionMgr.GetInstance().CurrentVisionProcessDir == null &&
                ParamSetMgr.GetInstance().CurrentProductFile == null &&
                ParamSetMgr.GetInstance().CurrentProductFile == "" &&
                !Directory.Exists(VisionMgr.GetInstance().CurrentVisionProcessDir))
            {
                Directory.CreateDirectory(VisionMgr.GetInstance().CurrentVisionProcessDir);
            }
            dicVisionType.Clear();
            dicVisionType = (SerialDictionary <string, StepVisionInfo>)AccessXmlSerializer.XmlToObject(strVisionConfigPath, dicVisionType.GetType());

            dicVision.Clear();
            if (dicVisionType == null)
            {
                dicVisionType = new SerialDictionary <string, StepVisionInfo>();
            }
            foreach (var temp in dicVisionType)
            {
                Type     type = AssemblyOperate.GetTypeFromAssembly(temp.Value.VisionType);
                object[] args = new object[]
                {
                    temp.Key
                };
                Add(temp.Key, Activator.CreateInstance(type, args) as VisionSetpBase);
                dicVision[temp.Key].Read();
                dicVision[temp.Key].m_camparam = temp.Value.CamParam;
            }
        }
示例#4
0
        public override bool GenObj(HObject image, VisionControl visionControl)
        {
            try
            {
                HTuple hv_BarCodeModel = null;
                if (Mode1dCode != null)
                {
                    HOperatorSet.ClearBarCodeModel(Mode1dCode);
                }

                HOperatorSet.CreateBarCodeModel(new HTuple(), new HTuple(), out hv_BarCodeModel);
                Mode1dCode = hv_BarCodeModel;

                string Mode1dcodePath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + "_bar_code_model.bcm";
                HOperatorSet.WriteBarCodeModel(Mode1dCode, Mode1dcodePath);

                string imgpath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".bmp";
                if (image != null && image.IsInitialized())
                {
                    HOperatorSet.WriteImage(image, "bmp", 0, imgpath);
                }
            }
            catch (HalconException e)
            {
                MessageBox.Show(m_strStepName + "创建1CodeModle失败:" + e.Message, "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            return(true);
        }
示例#5
0
        public override Object Read()
        {
            VisionCode2dParam tempvision2dCodeParam = null;
            string            strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";

            //tempvision2dCodeParam = (VisionCode2dParam)AccessXmlSerializer.XmlToObject(strPath, vision2dCodeParam.GetType());
            strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".json";
            Vision2dCode vision2DCode = (Vision2dCode)AccessJosnSerializer.JsonToObject(strPath, this.GetType());

            if (vision2DCode == null || vision2DCode.vision2dCodeParam == null)
            {
                _logger.Warn(m_strStepName + ": 视觉处理项目加载失败,请检查");
                MessageBox.Show(m_strStepName + ": 视觉处理项目加载失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
            vision2dCodeParam = tempvision2dCodeParam = vision2DCode.vision2dCodeParam;

            string Mode2dcodePath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + "_data_code_model.dcm";;

            if (vision2dCodeParam != null && Mode2dcodePath != null && File.Exists(Mode2dcodePath))
            {
                if (Mode2dCode != null)
                {
                    HOperatorSet.ClearDataCode2dModel(Mode2dCode);
                }
                Mode2dCode = null;
                HOperatorSet.ReadDataCode2dModel(Mode2dcodePath, out Mode2dCode);
                if (Mode2dCode == null || Mode2dCode.Length <= 0)
                {
                    _logger.Warn(m_strStepName + ": 2维码模板读取失败,请检查");
                    MessageBox.Show(m_strStepName + ": 2维码模板读取失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                // MessageBox.Show(m_strStepName + ": 2维码模板读取失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (vision2dCodeParam != null && File.Exists(vision2dCodeParam.Mode2dcodeSearchPath))
            {
                if (Mode2dCodeSearch != null && Mode2dCodeSearch.IsInitialized())
                {
                    Mode2dCodeSearch.Dispose();
                }
                HOperatorSet.ReadRegion(out Mode2dCodeSearch, vision2dCodeParam.Mode2dcodeSearchPath);
                if (Mode2dCodeSearch == null || Mode2dCodeSearch.IsInitialized())
                {
                    _logger.Warn(m_strStepName + ": 2维码搜索区域读取失败,请检查");
                }
                //  MessageBox.Show(m_strStepName + ": 2维码搜索区域读取失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                _logger.Warn(m_strStepName + ": 2维码搜索区域读取失败,请检查");
                //  MessageBox.Show(m_strStepName + ": 2维码搜索区域读取失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            GC.Collect();

            return(vision2dCodeParam);
        }
示例#6
0
        public override Object Read(string strPath)
        {
            Code1dParam tempvision1dCodeParam = (Code1dParam)AccessXmlSerializer.XmlToObject(strPath, vision1dCodeParam.GetType());

            if (tempvision1dCodeParam == null)
            {
                _logger.Warn(m_strStepName + ": 视觉处理项目加载失败,请检查");
                MessageBox.Show(m_strStepName + ": 视觉处理项目加载失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
            vision1dCodeParam = tempvision1dCodeParam;
            string Mode1dcodePath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + "_bar_code_model.bcm";;

            if (Mode1dcodePath != null && File.Exists(Mode1dcodePath))
            {
                if (Mode1dCode != null)
                {
                    HOperatorSet.ClearBarCodeModel(Mode1dCode);
                }
                HOperatorSet.ReadBarCodeModel(Mode1dcodePath, out Mode1dCode);
            }
            if (File.Exists(vision1dCodeParam.Mode1dcodeSearchPath))
            {
                if (Mode1dCodeSearch != null && Mode1dCodeSearch.IsInitialized())
                {
                    Mode1dCodeSearch.Dispose();
                }
                HOperatorSet.ReadRegion(out Mode1dCodeSearch, vision1dCodeParam.Mode1dcodeSearchPath);
            }
            GC.Collect();

            return(vision1dCodeParam);
        }
示例#7
0
        public override void Save()
        {
            string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";

            // AccessXmlSerializer.ObjectToXml(strPath, vision1dCodeParam);
            strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".json";
            AccessJosnSerializer.ObjectToJson(strPath, this);
        }
示例#8
0
        public virtual void Save()
        {
            string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";

            AccessXmlSerializer.ObjectToXml(strPath, this);
            strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".json";
            AccessJosnSerializer.ObjectToJson(strPath, this);
        }
示例#9
0
        public void Delete()
        {
            string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + m_strStepName;

            if (Directory.Exists(strPath))
            {
                FileOpert.DeleteFolder(strPath);
            }
        }
示例#10
0
        public virtual Object Read()
        {
            string strPath = "";

            strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".json";
            AccessJosnSerializer.ObjectToJson(strPath, this);
            strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";
            return(AccessXmlSerializer.XmlToObject(strPath, this.GetType()));
        }
示例#11
0
        public override Object Read()
        {
            //string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";
            //blobParam = (BlobParam)AccessXmlSerializer.XmlToObject(strPath, blobParam.GetType());

            string     strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".json";
            VisionBlob obj     = (VisionBlob)AccessJosnSerializer.JsonToObject(strPath, this.GetType());

            GC.Collect();

            return(blobParam);
        }
示例#12
0
 public static VisionMgr GetInstance()
 {
     if (visionMgr == null)
     {
         lock (objlock)
         {
             if (visionMgr == null)
             {
                 visionMgr = new VisionMgr();
             }
         }
     }
     return(visionMgr);
 }
示例#13
0
 public override void Save()
 {
     try
     {
         //string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";
         //if (visionFitCircleParam != null)
         //    AccessXmlSerializer.ObjectToXml(strPath, visionFitCircleParam);
         string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + m_strStepName + "\\" + m_strStepName + ".json";
         AccessJosnSerializer.ObjectToJson(strPath, this);
     }
     catch (Exception e)
     {
         _logger.Warn(m_strStepName + "保存失败:" + e.Message);
     }
 }
示例#14
0
        public override void Save()
        {
            //string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";
            //if (strSavePath != "")
            //    strPath = strSavePath + "\\" + m_strStepName + ".xml";
            //AccessXmlSerializer.ObjectToXml(strPath, visionShapParam);

            string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".json";

            if (strSavePath != "")
            {
                strPath = strSavePath + "\\" + m_strStepName + ".json";
            }
            AccessJosnSerializer.ObjectToJson(strPath, this);
            // SaveRegions();
        }
示例#15
0
        public void Save()
        {
            string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + "VisionMgr" + ".xml";

            dicVisionType.Clear();

            foreach (var temp in dicVision)
            {
                StepVisionInfo stepVisionInfo = new StepVisionInfo();
                stepVisionInfo.VisionType = temp.Value.GetType().ToString();
                stepVisionInfo.CamParam   = temp.Value.m_camparam;
                dicVisionType.Add(temp.Key, stepVisionInfo);
                dicVision[temp.Key].Save();
                if (PrItemChangedEvent != null)
                {
                    PrItemChangedEvent(temp.Key);
                }
            }
            AccessXmlSerializer.ObjectToXml(strPath, dicVisionType);
        }
示例#16
0
        public override bool GenObj(HObject image, VisionControl visionControl)
        {
            // HOperatorSet.CreateAnisoShapeModel()
            HTuple hv_Row1 = null, hv_Column1 = null, hv_Row2 = null;
            HTuple hv_Column2 = null, hv_ModelID = null, hv_Row = null;
            HTuple hv_Column = null, hv_Angle = null, hv_ScaleR = null;
            HTuple hv_ScaleC = null, hv_Score = null;
            string strPathRoi = visionShapParam.RoiRegionPath;

            if (!File.Exists(strPathRoi))
            {
                MessageBox.Show("Roi 不存在,请画ROI", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            if (image == null || !image.IsInitialized())
            {
                MessageBox.Show("图片不存在,请先读取图片", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            HObject ho_ImageReduced = null, ho_Rectangle = null;

            try
            {
                HOperatorSet.ReadRegion(out ho_Rectangle, strPathRoi);
                HOperatorSet.ReduceDomain(image, ho_Rectangle, out ho_ImageReduced);
                if (visionShapParam.ModeType.ToString() == "形状")
                {
                    HOperatorSet.EdgesSubPix(ho_ImageReduced, out HObject edges, "canny", 2, visionShapParam.ContrastLow, visionShapParam.ContrastHigh);
                    if (visionShapParam.CratePyramid == 0)
                    {
                        HOperatorSet.CreateShapeModelXld(edges, "auto", (new HTuple(visionShapParam.AngleStart)).TupleRad(), (new HTuple(visionShapParam.AngleExtent)).TupleRad(), new HTuple(0.05), "auto",
                                                         new HTuple(visionShapParam.strPolaritySel), 5, out hv_ModelID);
                    }
                    else
                    {
                        HOperatorSet.CreateShapeModelXld(edges, visionShapParam.CratePyramid, (new HTuple(visionShapParam.AngleStart)).TupleRad()
                                                         , (new HTuple(visionShapParam.AngleExtent)).TupleRad(), new HTuple(0.05), "auto", new HTuple(visionShapParam.strPolaritySel), 5, out hv_ModelID);
                    }
                    HOperatorSet.GetShapeModelParams(hv_ModelID, out HTuple numlevels, out HTuple startangle,
                                                     out HTuple endextend, out HTuple anglestep, out HTuple scaleMin, out HTuple scaleMax, out HTuple scalestep, out HTuple metric, out HTuple minContrast);
                    visionShapParam.MatchPyamidHigh = numlevels.I;

                    string strPathMode = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + "_Mode" + ".shm";
                    if (strSavePath != "")
                    {
                        strPathMode = strSavePath + "\\" + m_strStepName + "_Mode" + ".shm";
                    }
                    visionShapParam.ModeShmPath = strPathMode;
                    HOperatorSet.WriteShapeModel(hv_ModelID, strPathMode);
                }
                else
                {
                    HOperatorSet.CreateNccModel(ho_ImageReduced, "auto", (new HTuple(visionShapParam.AngleStart)).TupleRad(), (new HTuple(visionShapParam.AngleExtent)).TupleRad(), "auto", new HTuple(visionShapParam.strPolaritySel),
                                                out hv_ModelID);
                }

                string strPathModeImg = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + "_ModeImg" + ".bmp";
                if (strSavePath != "")
                {
                    strPathModeImg = strSavePath + "\\" + m_strStepName + "_ModeImg" + ".bmp";
                }
                visionShapParam.ModeImgPath = strPathModeImg;
                HOperatorSet.WriteImage(image, "bmp", 0, strPathModeImg);
                //if (ModeID != null)//清楚上次模板
                //{
                //    if (visionShapParam.ModeType == "形状")
                //    {
                //        HOperatorSet.ClearShapeModel(ModeID);
                //    }
                //    else
                //    {
                //        HOperatorSet.ClearNccModel(ModeID);
                //    }
                //}

                ModeID = hv_ModelID;

                Save();
                if (Process_image(image, visionControl) && visionShapParam.ResultCol.Count > 0)
                {
                    visionShapParam.ModlePoint.x = visionShapParam.ResultCol[0];
                    visionShapParam.ModlePoint.y = visionShapParam.ResultRow[0];
                    visionShapParam.ModlePoint.u = visionShapParam.ResultAngle[0];
                    if (visionControl != null && visionControl.isOpen())
                    {
                        HalconExternFunExport.disp_message(visionControl.GetHalconWindow(), "匹配成功", "window", 100, 100, "green", "false");
                    }
                    if (!visionShapParam.bSetOutPoint)
                    {
                        visionShapParam.OutPointInModleImage = new Point2d(visionShapParam.ModlePoint.x, visionShapParam.ModlePoint.y);
                    }
                }
                else
                {
                    MessageBox.Show(m_strStepName + ":创建模板失败-", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
            }
            catch (HalconException e)
            {
                MessageBox.Show(m_strStepName + ":创建模板失败-" + e.Message, "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            finally
            {
                if (GenFinished != null)
                {
                    GenFinished();
                }
                ho_Rectangle?.Dispose();
                ho_ImageReduced?.Dispose();
                GC.Collect();
            }

            return(true);
        }
示例#17
0
        public override Object Read()
        {
            try
            {
                VisionShapParam tempvisionShapParam = null;
                string          strPath             = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";
                if (strSavePath != "")
                {
                    strPath = strSavePath + "\\" + m_strStepName + ".xml";
                }

                strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".json";
                if (strSavePath != "")
                {
                    strPath = strSavePath + "\\" + m_strStepName + ".json";
                }

                object visionShapMatch2 = AccessJosnSerializer.JsonToObject(strPath, typeof(object));

                //string json = visionShapMatch2.ToString();
                //var q = JsonConvert.DeserializeObject<dynamic>(json);
                //Newtonsoft.Json.Linq.JObject jobj = Newtonsoft.Json.Linq.JObject.Parse(json);
                //string jsonShapelist= jobj["shapeslist"].ToString();
                //List<shapeparam> ss =  JsonConvert.DeserializeObject<List<shapeparam>>(jsonShapelist);
                //var qq = JsonConvert.DeserializeObject<dynamic>(jsonShapelist);
                //Newtonsoft.Json.Linq.JObject jobjShape = Newtonsoft.Json.Linq.JObject.Parse(qq.ToString());
                //string jsonShapelists = jobjShape["usrshape"].ToString();

                VisionShapMatch visionShapMatch = (VisionShapMatch)AccessJosnSerializer.JsonToObject(strPath, this.GetType());
                string          str             = visionShapMatch2.ToString();
                int             indexFindex     = str.IndexOf("\"shapeslist\":");
                string          sub1            = str.Substring(indexFindex);
                int             indexFirist     = sub1.IndexOf("[");
                string          sub2            = sub1.Substring(indexFirist);
                int             indexLast       = sub2.IndexOf("]");
                int             nLen            = indexLast - indexFirist;
                if (indexLast != -1 && indexFirist != -1 && nLen > 0)
                {
                    string sub    = sub2.Substring(0, indexLast + 1);
                    string strReg = "<Item>";

                    List <object> list = (List <object>)JsonConvert.DeserializeObject(sub, typeof(List <object>));
                    // List<shapeparam> list = (List<shapeparam>)AccessJosnSerializer.JsonToObject(strPath,typeof( shapeparam));

                    for (int i = 0; i < list.Count; i++)
                    {
                        if (list[i].ToString() != null)
                        {
                            int index = list[i].ToString().IndexOf("\"usrshape\": ");
                            if (index != -1)
                            {
                                string Itemstring  = list[i].ToString();
                                string subusrshape = list[i].ToString().Substring(index);
                                int    index2      = subusrshape.IndexOf("{");
                                int    index3      = subusrshape.IndexOf("}");

                                if (index2 != -1 && index3 != -1)
                                {
                                    int nLenOfUserShape = index3 - index2;

                                    string subusrshapeObj = subusrshape.Substring(index2 - 1, nLenOfUserShape + 2);

                                    Type      TY  = AssemblyOperate.GetTypeFromAssembly(visionShapMatch.shapeslist[i].usrshape.UserTypeName);
                                    UserShape tem = (UserShape)JsonConvert.DeserializeObject(subusrshapeObj, TY);
                                    visionShapMatch.shapeslist[i].usrshape = tem;
                                }
                            }
                        }
                    }
                }

                if (visionShapMatch == null || visionShapMatch.visionShapParam == null)
                {
                    MessageBox.Show(m_strStepName + ": 视觉处理项目加载失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    _logger.Warn(m_strStepName + ": 视觉处理项目加载失败,请检查");
                    return(null);
                }
                visionShapParam = tempvisionShapParam = visionShapMatch.visionShapParam;
                this.shapeslist.Clear();
                int nIndex = 0;
                for (int s = 0; s < visionShapMatch.shapeslist.Count; s++)
                {
                    shapeslist.Add(new shapeparam()
                    {
                        name      = visionShapMatch.shapeslist[s].name,
                        shapeType = visionShapMatch.shapeslist[s].shapeType,
                        usrshape  = visionShapMatch.shapeslist[s].usrshape.Clone(),
                    });
                }
                string ModeShmPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + "_Mode.shm";
                if (visionShapParam != null && visionShapParam.ModeType == eModleType.形状 && File.Exists(ModeShmPath))
                {
                    if (ModeID != null)
                    {
                        HOperatorSet.ClearShapeModel(ModeID);
                    }
                    ModeID = null;
                    HOperatorSet.ReadShapeModel(ModeShmPath, out ModeID);
                    if (ModeID == null || ModeID.Length <= 0)
                    {
                        MessageBox.Show(m_strStepName + "读取项目:" + "模板读取失败", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        _logger.Warn(m_strStepName + "读取项目:" + "模板读取失败");
                    }
                }
                else
                {
                    _logger.Warn(m_strStepName + "读取项目:" + "模板读取失败");
                    MessageBox.Show(m_strStepName + "读取项目:" + "模板读取失败", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                string SeachRectRegionPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + "_SearchRect.hobj";
                if (visionShapParam != null && File.Exists(SeachRectRegionPath))
                {
                    if (RegionSearch != null && RegionSearch.IsInitialized())
                    {
                        RegionSearch.Dispose();
                    }
                    HOperatorSet.ReadRegion(out RegionSearch, SeachRectRegionPath);
                    if (RegionSearch == null || RegionSearch.IsInitialized())
                    {
                        _logger.Warn(m_strStepName + "读取项目:" + "搜索区域读取失败");
                    }
                }
                else
                {
                    _logger.Warn(m_strStepName + "读取项目:" + "搜索区域读取失败");
                }
                string RoiRegionPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + "_Roi.hobj";
                if (visionShapParam != null && File.Exists(RoiRegionPath))
                {
                    if (RegionRoi != null && RegionRoi.IsInitialized())
                    {
                        RegionRoi.Dispose();
                    }
                    HOperatorSet.ReadRegion(out RegionRoi, RoiRegionPath);
                    if (RegionRoi == null || RegionRoi.IsInitialized())
                    {
                        _logger.Warn(m_strStepName + "读取项目:" + "roi读取失败");
                    }
                }
                else
                {
                    _logger.Warn(m_strStepName + "读取项目:" + "roi读取失败");
                }
            }
            catch (Exception e1)
            {
                _logger.Warn(m_strStepName + "读取项目:" + e1.Message);
                MessageBox.Show(m_strStepName + "读取项目:" + e1.Message, "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch
            {
                _logger.Warn(m_strStepName + "读取项目失败");
                MessageBox.Show(m_strStepName + "读取项目失败", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            GC.Collect();

            return(visionShapParam);
        }