예제 #1
0
파일: Mat.cs 프로젝트: formylover/emgucv-1
        /// <summary>
        /// Copy data from this Mat to the managed array
        /// </summary>
        /// <typeparam name="T">The type of managed data array</typeparam>
        /// <param name="data">The managed array where data will be copied to.</param>
        public void CopyTo <T>(T[] data)
        {
            Debug.Assert(Toolbox.SizeOf <T>() * data.Length >= Total.ToInt32() * ElementSize,
                         String.Format("Size of data is not enough, required at least {0}, but was {1} ", Total.ToInt32() * ElementSize / Toolbox.SizeOf <T>(), data.Length));
            GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);

            MatInvoke.cveMatCopyDataTo(this, handle.AddrOfPinnedObject());
            handle.Free();
        }