コード例 #1
0
ファイル: Model.cs プロジェクト: xhyangxianjun/ASMZZZ
        /// <summary>
        /// 释放模板信息
        /// </summary>
        /// <returns></returns>
        public bool DisposeModel()
        {
            for (int i = 0; i < modelID.Length; i++)
            {
                if (!Vision.ClearModel(modelType, modelID[i]))
                {
                    modelType = new HTuple();
                    modelID   = new HTuple();
                    return(false);
                }
            }
            modelType = new HTuple();
            modelID   = new HTuple();
            showContour.Dispose();
            defRows = new HTuple();
            defCols = new HTuple();
            matchRegion.Dispose();

            return(true);
        }
コード例 #2
0
ファイル: Model.cs プロジェクト: xhyangxianjun/ASMZZZ
        /// <summary>
        /// 2019.5.21 临时使用 测试新的矫正点 算法
        /// </summary>
        /// <param name="modelDirPath"></param>
        /// <returns></returns>
        public bool ReadModelCorrect(string modelDirPath)
        {
            try
            {
                HTuple iFlag = null;
                showContour.Dispose();
                if (modelID != null)
                {
                    Vision.ClearModel(modelType, modelID);
                }
                ToolKits.FunctionModule.Vision.read_model(out showContour, modelDirPath, out modelType, out modelID, out defRows, out defCols, out iFlag);
                if (iFlag.I != 0)
                {
                    Dispose();
                    return(false);
                }
                //???????
                //HOperatorSet.ReadTuple(modelDirPath + "\\angleStart.tup", out angleStart);
                //HOperatorSet.ReadTuple(modelDirPath + "\\angleExtent.tup", out angleExtent);
                //HOperatorSet.ReadTuple(modelDirPath + "\\scoreThresh.tup", out scoreThresh);
                showImage.Dispose();
                if (File.Exists(modelDirPath + "\\showImage.tiff"))
                {
                    HOperatorSet.ReadImage(out showImage, modelDirPath + "\\showImage.tiff");
                }
                matchRegion.Dispose();
                if (File.Exists(modelDirPath + "\\matchRegion.reg"))
                {
                    HOperatorSet.ReadRegion(out matchRegion, modelDirPath + "\\matchRegion.reg");
                }

                HOperatorSet.ReadTuple(modelDirPath + "\\cornorRows.dat", out refPointsRow);
                HOperatorSet.ReadTuple(modelDirPath + "\\cornorCols.dat", out refPointsCol);
                HOperatorSet.ReadTuple(modelDirPath + "\\hLinesCol.dat", out hLineCols);
                HOperatorSet.ReadTuple(modelDirPath + "\\hLinesRow.dat", out hLineRows);
                HOperatorSet.ReadTuple(modelDirPath + "\\vLinesCol.dat", out vLineCols);
                HOperatorSet.ReadTuple(modelDirPath + "\\vLinesRow.dat", out vLineRows);



                //加载其它modelID0-n
                //string[] files = Directory.GetFiles(modelDirPath, "modelID*.dat");
                //for (int i = 0; i < files.Length; i++)
                //{
                //    HTuple _modelID = new HTuple();
                //    if (modelType.I == 0)
                //    {
                //        HOperatorSet.ReadNccModel(files[i], out _modelID);
                //    }
                //    else
                //    {
                //        HOperatorSet.ReadShapeModel(files[i], out _modelID);
                //    }
                //    HTuple _defRow, _defCol;
                //    //HOperatorSet.ReadTuple(modelDirPath + "\\defRow*" + i.ToString() + ".tup", out _defRow);
                //    //HOperatorSet.ReadTuple(modelDirPath + "\\defCol*" + i.ToString() + ".tup", out _defCol);
                //    HOperatorSet.ReadTuple(modelDirPath + "\\defRow" + ".tup", out _defRow);
                //    HOperatorSet.ReadTuple(modelDirPath + "\\defCol" + ".tup", out _defCol);
                //    //modelID.Append(_modelID);
                //    //defRows.Append(_defRow);
                //    //defCols.Append(_defCol);
                //}
                return(true);
            }
            catch (Exception)
            {
                Dispose();
                return(false);
            }
        }