Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public BoundingBox[] Detect(string filename)
        {
            var container = new BboxContainer();
            var count     = DetectImage(filename, ref container);

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