Exemplo n.º 1
0
        }                                           //检测深度

        internal StDetectParam GetSt()
        {
            StDetectParam stDetectParam = new StDetectParam
            {
                CameraNo   = CameraNo,
                Left       = Left,
                Right      = Right,
                Up         = Up,
                Down       = Down,
                StartY     = StartY,
                AlarmWidth = AlarmWidth,
                AlarmDepth = AlarmDepth
            };

            return(stDetectParam);
        }
Exemplo n.º 2
0
        static IntPtr pResultBuff = Marshal.AllocHGlobal(size); //指向算法结果的内存指针

        public static AlgorithmResult[] DetectImage(IntPtr imageHandle, StDetectParam detectParam)
        {
            //清零存放算法结果的内存区域
            byte[] zeroBytes = new byte[size];
            zeroBytes.Initialize();
            Marshal.Copy(zeroBytes, 0, pResultBuff, size);
            DetectAlgorithm(imageHandle, detectParam, 1, pResultBuff);
            //用来存放算法返回的报警信息
            AlgorithmResult[] newAlarmInfos = new AlgorithmResult[AlarmInfoCount];
            for (int alarmInfoIndex = 0; alarmInfoIndex < AlarmInfoCount; alarmInfoIndex++)
            {
                //获取每一个报警信息
                newAlarmInfos[alarmInfoIndex] = new AlgorithmResult();
                IntPtr pAlarmInfo = new IntPtr(pResultBuff.ToInt64() + Marshal.SizeOf(typeof(AlgorithmResult)) * alarmInfoIndex);
                newAlarmInfos[alarmInfoIndex] = (AlgorithmResult)Marshal.PtrToStructure(pAlarmInfo, typeof(AlgorithmResult));
            }
            return(newAlarmInfos);
        }
Exemplo n.º 3
0
 public static extern void DetectAlgorithm(IntPtr imageHandle, StDetectParam detectParam, int cameraNo, IntPtr alarmInfo);