Exemple #1
0
        /// <summary>
        /// 检测任务传递函数,抛弃
        /// </summary>
        /// <param name="srcPath"></param>
        /// <param name="PrcdPath"></param>
        /// <param name="detectinfo"></param>
        /// <returns></returns>
        public int DetectTaskSend(string srcPath, ref string PrcdPath, ref DetectInfo detectinfo, int cameraOption)
        {
            //处理结束的图像保存路径
            PrcdPath = DLLDefine.ImgDBFolder + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + "_Detect_" + ".jpg";

            TaskInfo task = detectinfo.TASKINFO;                                                    //直接将Taskinfo输入,关于赋值是在解析配置文件时赋值

            ROIInfo roi = detectinfo.ROIINFO;                                                       //直接将ROIinfo输入,关于赋值是在解析配置文件时赋值

            ResultTemp resultTemp = new ResultTemp();                                               //处理结果临时变量

            visionAlgorithm.DetectTask(srcPath, roi, task, PrcdPath, ref resultTemp, cameraOption); //调用DLL接口进行图像处理

            // 数据转换
            detectinfo.RESULTINFO = detectinfo.ResultTempToResultInfo(resultTemp);

            // 释放内存,指针传值的地方(如果申请了内存)
            if (resultTemp.arrayResult != IntPtr.Zero)
            {
                visionAlgorithm.ReleaseMemoryFromC(resultTemp.arrayResult);
            }

            return(DLLDefine.sg_OK);
        }
Exemple #2
0
        // 转换数据,其实只是为了转换指针为数组
        public ResultInfo ResultTempToResultInfo(ResultTemp temp)
        {
            ResultInfo info = new ResultInfo();

            if (DLLDefine.sg_task_analog == TASKINFO.type)  //模拟指示器是数组形式
            {
                int[] resultarr = new int[TASKINFO.number];
                if (temp.arrayResult != IntPtr.Zero)
                {
                    Marshal.Copy(temp.arrayResult, resultarr, 0, TASKINFO.number);
                    info.arrayResult = resultarr;
                }
            }
            else if (DLLDefine.sg_task_knob == TASKINFO.type)
            {
                info.result = temp.result;
            }
            else if (DLLDefine.sg_task_pointer == TASKINFO.type)
            {
                info.result = temp.result;
            }
            else if (DLLDefine.sg_task_switch == TASKINFO.type)
            {
                info.result = temp.result;
            }
            else if (DLLDefine.sg_task_led == TASKINFO.type)    //指示灯是数组形式
            {
                int[] resultarr = new int[TASKINFO.number];
                if (temp.arrayResult != IntPtr.Zero)
                {
                    Marshal.Copy(temp.arrayResult, resultarr, 0, TASKINFO.number);
                    info.arrayResult = resultarr;
                }
            }
            return(info);
        }
Exemple #3
0
 public static extern int DetectTask(string filename, ROIInfo roi, TaskInfo taskinfo, string processedName, ref ResultTemp resultTemp, int cameraType);