vector_Mat_assignToArray() private method

private vector_Mat_assignToArray ( IntPtr vector, [ arr ) : void
vector IntPtr
arr [
return void
Ejemplo n.º 1
0
        /// <summary>
        /// Converts std::vector to managed array
        /// </summary>
        /// <returns></returns>
        public T[] ToArray <T>()
            where T : Mat, new()
        {
            int size = Size;

            if (size == 0)
            {
                return(new T[0]);
            }

            T[]      dst    = new T[size];
            IntPtr[] dstPtr = new IntPtr[size];
            for (int i = 0; i < size; i++)
            {
                T m = new T();
                dst[i]    = m;
                dstPtr[i] = m.CvPtr;
            }
            NativeMethods.vector_Mat_assignToArray(ptr, dstPtr);

            return(dst);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Converts std::vector to managed array
        /// </summary>
        /// <returns></returns>
        public T[] ToArray <T>()
            where T : Mat, new()
        {
            var size = Size;

            if (size == 0)
            {
                return(Array.Empty <T>());
            }

            var dst    = new T[size];
            var dstPtr = new IntPtr[size];

            for (var i = 0; i < size; i++)
            {
                var m = new T();
                dst[i]    = m;
                dstPtr[i] = m.CvPtr;
            }
            NativeMethods.vector_Mat_assignToArray(ptr, dstPtr);
            GC.KeepAlive(this);

            return(dst);
        }