示例#1
0
        public BoundingBox[] Detect(byte[] imageData)
        {
            var container = new BboxContainer();

            var size = Marshal.SizeOf(imageData[0]) * imageData.Length;
            var pnt  = Marshal.AllocHGlobal(size);

            try
            {
                Marshal.Copy(imageData, 0, pnt, imageData.Length);
                var count = DetectImage(pnt, imageData.Length, ref container);
                if (count == -1)
                {
                    throw new NotSupportedException($"{YoloLibraryName} has no OpenCV support");
                }
            }
            catch (Exception exception)
            {
                return(null);
            }
            finally
            {
                Marshal.FreeHGlobal(pnt);
            }

            return(container.candidates);
        }
示例#2
0
        public BoundingBox[] Detect(string filename)
        {
            var container = new BboxContainer();
            var count     = DetectImage(filename, ref container);

            return(container.candidates);
        }
示例#3
0
 private static extern int DetectImage(IntPtr pArray, int nSize, ref BboxContainer container);
示例#4
0
 private static extern int DetectImage(string filename, ref BboxContainer container);