예제 #1
0
파일: Seq.cs 프로젝트: highwayns/opencv.net
        /// <summary>
        /// Makes a separate header for a sequence slice.
        /// </summary>
        /// <param name="slice">The part of the sequence to be extracted.</param>
        /// <param name="storage">The storage block that will store the new sequence.</param>
        /// <param name="copyData">
        /// A value indicating whether to copy the elements of the extracted slice.
        /// </param>
        /// <returns>
        /// A new <see cref="Seq"/> instance containing the elements in the
        /// specified <paramref name="slice"/>.
        /// </returns>
        public Seq Slice(SeqSlice slice, MemStorage storage = null, bool copyData = false)
        {
            storage = storage ?? owner;
            var seq = NativeMethods.cvSeqSlice(this, slice, storage, copyData ? 1 : 0);

            seq.SetOwnerStorage(storage);
            return(seq);
        }
예제 #2
0
파일: Seq.cs 프로젝트: highwayns/opencv.net
        /// <summary>
        /// Copies part of the sequence elements to a compatible one-dimensional array.
        /// </summary>
        /// <typeparam name="TElement">The type of the elements in the sequence.</typeparam>
        /// <param name="array">The array on which to store sequence elements.</param>
        /// <param name="slice">The portion of the sequence to copy to the array.</param>
        public void CopyTo <TElement>(TElement[] array, SeqSlice slice) where TElement : struct
        {
            var arrayHandle = GCHandle.Alloc(array, GCHandleType.Pinned);

            try
            {
                NativeMethods.cvCvtSeqToArray(this, arrayHandle.AddrOfPinnedObject(), slice);
            }
            finally { arrayHandle.Free(); }
        }
예제 #3
0
파일: Seq.cs 프로젝트: highwayns/opencv.net
 /// <summary>
 /// Removes a sequence slice.
 /// </summary>
 /// <param name="slice">The part of the sequence to remove.</param>
 public void Remove(SeqSlice slice)
 {
     NativeMethods.cvSeqRemoveSlice(this, slice);
 }