示例#1
0
        public CoreRectangleCandidate[] ProcessImage(byte[] imageData)
        {
            var container = new CoreRectangleCandidateContainer();

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

            try
            {
                // Copy the array to unmanaged memory.
                Marshal.Copy(imageData, 0, pnt, imageData.Length);
                tr_process_image(pnt, imageData.Length, ref container);
            }
            catch (Exception exception)
            {
                return(null);
            }
            finally
            {
                // Free the unmanaged memory.
                Marshal.FreeHGlobal(pnt);
            }

            return(container.candidates.Where(o => o.confidence > 0).ToArray());
        }
示例#2
0
 internal static extern int tr_process_image(IntPtr pArray, int nSize, ref CoreRectangleCandidateContainer container);