Class Seq
Represents a growable sequence of elements.
Namespace: OpenCV.Net
Assembly: OpenCV.Net.dll
Syntax
public class Seq : CVHandle
Constructors
| Improve this Doc View SourceSeq(Depth, Int32, MemStorage)
Initializes a new instance of the Seq class with the specified
element bit depth
and channels
per element.
Memory for the sequence will be allocated from the provided storage
.
Declaration
public Seq(Depth depth, int channels, MemStorage storage)
Parameters
Type | Name | Description |
---|---|---|
Depth | depth | The bit depth of sequence elements. |
Int32 | channels | The number of channels per sequence element. |
MemStorage | storage | The memory storage used to grow the sequence. |
Seq(Depth, Int32, SequenceKind, MemStorage)
Initializes a new instance of the Seq class with the specified
element bit depth
, channels
per element and
sequence kind
.
Memory for the sequence will be allocated from the provided storage
.
Declaration
public Seq(Depth depth, int channels, SequenceKind kind, MemStorage storage)
Parameters
Type | Name | Description |
---|---|---|
Depth | depth | The bit depth of sequence elements. |
Int32 | channels | The number of channels per sequence element. |
SequenceKind | kind | The kind of sequence to create. |
MemStorage | storage | The memory storage used to grow the sequence. |
Seq(Depth, Int32, SequenceKind, SequenceFlags, MemStorage)
Initializes a new instance of the Seq class with the specified
element bit depth
, channels
per element,
sequence kind
and operational flags
.
Memory for the sequence will be allocated from the provided storage
.
Declaration
public Seq(Depth depth, int channels, SequenceKind kind, SequenceFlags flags, MemStorage storage)
Parameters
Type | Name | Description |
---|---|---|
Depth | depth | The bit depth of sequence elements. |
Int32 | channels | The number of channels per sequence element. |
SequenceKind | kind | The kind of sequence to create. |
SequenceFlags | flags | The operational flags for the sequence. |
MemStorage | storage | The memory storage used to grow the sequence. |
Seq(SequenceElementType, MemStorage)
Initializes a new instance of the Seq class from a specified
common element type. Memory for the sequence will be allocated from the
provided storage
.
Declaration
public Seq(SequenceElementType elementType, MemStorage storage)
Parameters
Type | Name | Description |
---|---|---|
SequenceElementType | elementType | The type of elements in the sequence. |
MemStorage | storage | The memory storage used to grow the sequence. |
Seq(SequenceElementType, SequenceKind, MemStorage)
Initializes a new instance of the Seq class with the specified
common element type and sequence kind
.
Memory for the sequence will be allocated from the provided storage
.
Declaration
public Seq(SequenceElementType elementType, SequenceKind kind, MemStorage storage)
Parameters
Type | Name | Description |
---|---|---|
SequenceElementType | elementType | The type of elements in the sequence. |
SequenceKind | kind | The kind of sequence to create. |
MemStorage | storage | The memory storage used to grow the sequence. |
Seq(SequenceElementType, SequenceKind, SequenceFlags, MemStorage)
Initializes a new instance of the Seq class with the specified
common element type, sequence kind
and operational flags
.
Memory for the sequence will be allocated from the provided storage
.
Declaration
public Seq(SequenceElementType elementType, SequenceKind kind, SequenceFlags flags, MemStorage storage)
Parameters
Type | Name | Description |
---|---|---|
SequenceElementType | elementType | The type of elements in the sequence. |
SequenceKind | kind | The kind of sequence to create. |
SequenceFlags | flags | The operational flags for the sequence. |
MemStorage | storage | The memory storage used to grow the sequence. |
Properties
| Improve this Doc View SourceCount
Gets the total number of elements in the sequence.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
ElementSize
Gets the size of a sequence element in bytes.
Declaration
public int ElementSize { get; }
Property Value
Type | Description |
---|---|
Int32 |
HeaderSize
Gets the size of the Seq header, in bytes.
Declaration
public static int HeaderSize { get; }
Property Value
Type | Description |
---|---|
Int32 |
HNext
Gets the next sequence on the same hierarchical level.
Declaration
public Seq HNext { get; set; }
Property Value
Type | Description |
---|---|
Seq |
HPrev
Gets the previous sequence on the same hierarchical level.
Declaration
public Seq HPrev { get; set; }
Property Value
Type | Description |
---|---|
Seq |
Kind
Gets a SequenceKind value indicating the kind of the sequence.
Declaration
public SequenceKind Kind { get; }
Property Value
Type | Description |
---|---|
SequenceKind |
Storage
Gets the MemStorage where the sequence is stored.
Declaration
public MemStorage Storage { get; }
Property Value
Type | Description |
---|---|
MemStorage |
VNext
Gets the first child of the sequence in the hierarchy.
Declaration
public Seq VNext { get; set; }
Property Value
Type | Description |
---|---|
Seq |
VPrev
Gets the parent of the sequence in the hierarchy.
Declaration
public Seq VPrev { get; set; }
Property Value
Type | Description |
---|---|
Seq |
Methods
| Improve this Doc View SourceClear()
Removes all elements from the sequence.
Declaration
public virtual void Clear()
Clone(MemStorage)
Creates a copy of the sequence.
Declaration
public Seq Clone(MemStorage storage = null)
Parameters
Type | Name | Description |
---|---|---|
MemStorage | storage | The destination MemStorage instance on which to store the new sequence.
If |
Returns
Type | Description |
---|---|
Seq | A new Seq instance that is a copy of this sequence. |
CopyTo<TElement>(TElement[])
Copies all the elements of the sequence to a compatible one-dimensional array.
Declaration
public void CopyTo<TElement>(TElement[] array)
where TElement : struct
Parameters
Type | Name | Description |
---|---|---|
TElement[] | array | The array on which to store sequence elements. |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements in the sequence. |
CopyTo<TElement>(TElement[], SeqSlice)
Copies part of the sequence elements to a compatible one-dimensional array.
Declaration
public void CopyTo<TElement>(TElement[] array, SeqSlice slice)
where TElement : struct
Parameters
Type | Name | Description |
---|---|---|
TElement[] | array | The array on which to store sequence elements. |
SeqSlice | slice | The portion of the sequence to copy to the array. |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements in the sequence. |
GetElement(Int32)
Gets the pointer to the element at the specified index.
Declaration
public IntPtr GetElement(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the element to retrieve. |
Returns
Type | Description |
---|---|
IntPtr | A pointer to the element at the specified |
GetElementIndex(IntPtr)
Gets the index of the specified element.
Declaration
public int GetElementIndex(IntPtr element)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | element | A pointer to the sequence element. |
Returns
Type | Description |
---|---|
Int32 | The index of the specified |
Insert(Int32, Arr)
Inserts an array in the middle of the sequence.
Declaration
public void Insert(int index, Arr array)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index at which to insert the array. |
Arr | array | The inserted array. |
Insert(Int32, Seq)
Inserts a sequence in the middle of this sequence.
Declaration
public void Insert(int index, Seq sequence)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index at which to insert the sequence. |
Seq | sequence | The inserted sequence. |
Insert<TElement>(Int32, TElement)
Inserts an element in the middle of the sequence.
Declaration
public void Insert<TElement>(int index, TElement element)
where TElement : struct
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index before which the element is inserted. |
TElement | element | The inserted element. |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements in the sequence. |
Invert()
Reverses the order of sequence elements.
Declaration
public void Invert()
Partition<TElement>(MemStorage, out Seq, Func<TElement, TElement, Boolean>)
Splits a sequence into equivalence classes.
Declaration
public int Partition<TElement>(MemStorage storage, out Seq labels, Func<TElement, TElement, bool> equalityComparison)
Parameters
Type | Name | Description |
---|---|---|
MemStorage | storage | The storage block to store the sequence of equivalence classes. |
Seq | labels | When the method returns, contains the sequence of zero-based labels of sequence elements. |
Func<TElement, TElement, Boolean> | equalityComparison | The relation function that should return true if the two particular sequence elements are from the same class, and false otherwise. The partitioning algorithm uses the transitive closure of the relation function as an equivalence critria |
Returns
Type | Description |
---|---|
Int32 | The number of equivalence classes. |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements in the sequence. |
Pop()
Removes an element from the end of the sequence.
Declaration
public void Pop()
Pop<TElement>(out TElement)
Removes an element from the end of the sequence.
Declaration
public void Pop<TElement>(out TElement element)
where TElement : struct
Parameters
Type | Name | Description |
---|---|---|
TElement | element | When the method returns, contains the element that was removed from the end of the sequence. |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements in the sequence. |
Pop<TElement>(TElement[])
Removes several elements from the end of the sequence.
Declaration
public void Pop<TElement>(TElement[] elements)
where TElement : struct
Parameters
Type | Name | Description |
---|---|---|
TElement[] | elements | The array that will contain the removed elements. |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements in the sequence. |
PopFront()
Removes an element from the beginning of the sequence.
Declaration
public void PopFront()
PopFront<TElement>(out TElement)
Removes an element from the beginning of the sequence.
Declaration
public void PopFront<TElement>(out TElement element)
where TElement : struct
Parameters
Type | Name | Description |
---|---|---|
TElement | element | When the method returns, contains the element that was removed from the beginning of the sequence. |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements in the sequence. |
PopFront<TElement>(TElement[])
Removes several elements from the beginning of the sequence.
Declaration
public void PopFront<TElement>(TElement[] elements)
where TElement : struct
Parameters
Type | Name | Description |
---|---|---|
TElement[] | elements | The array that will contain the removed elements. |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements in the sequence. |
Push()
Allocates space for one more element at the end of the sequence.
Declaration
public void Push()
Push<TElement>(TElement[])
Adds one or more elements to the end of the sequence.
Declaration
public void Push<TElement>(params TElement[] elements)
where TElement : struct
Parameters
Type | Name | Description |
---|---|---|
TElement[] | elements | The array of elements to add to the end of the sequence. |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements in the sequence. |
PushFront()
Allocates space for one more element at the beginning of the sequence.
Declaration
public void PushFront()
PushFront<TElement>(TElement[])
Adds one or more elements to the beginning of the sequence.
Declaration
public void PushFront<TElement>(params TElement[] elements)
where TElement : struct
Parameters
Type | Name | Description |
---|---|---|
TElement[] | elements | The array of elements to add to the beginning of the sequence. |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements in the sequence. |
ReleaseHandle()
Executes the code required to free the native Seq handle.
Declaration
protected override bool ReleaseHandle()
Returns
Type | Description |
---|---|
Boolean | true if the handle is released successfully; otherwise, in the event of a catastrophic failure, false. |
Remove(SeqSlice)
Removes a sequence slice.
Declaration
public void Remove(SeqSlice slice)
Parameters
Type | Name | Description |
---|---|---|
SeqSlice | slice | The part of the sequence to remove. |
Remove(Int32)
Removes an element from the middle of the sequence.
Declaration
public void Remove(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the removed element. |
Search<TElement>(TElement, Comparison<TElement>, Boolean)
Searches for an element in a sequence.
Declaration
public int Search<TElement>(TElement element, Comparison<TElement> comparison, bool isSorted)
where TElement : struct
Parameters
Type | Name | Description |
---|---|---|
TElement | element | The element to look for. |
Comparison<TElement> | comparison | The comparison function that returns negative, zero or positive value depending on the relationships among the elements. |
Boolean | isSorted | A value indicating whether the sequence is sorted or not. |
Returns
Type | Description |
---|---|
Int32 | The index of the element in the sequence, or -1 if it is not found. |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements in the sequence. |
SetBlockSize(Int32)
Sets the sequence block size.
Declaration
public void SetBlockSize(int blockSize)
Parameters
Type | Name | Description |
---|---|---|
Int32 | blockSize | The memory block size by which to grow the sequence when free space has run out. |
Slice(SeqSlice, MemStorage, Boolean)
Makes a separate header for a sequence slice.
Declaration
public Seq Slice(SeqSlice slice, MemStorage storage = null, bool copyData = false)
Parameters
Type | Name | Description |
---|---|---|
SeqSlice | slice | The part of the sequence to be extracted. |
MemStorage | storage | The storage block that will store the new sequence. |
Boolean | copyData | A value indicating whether to copy the elements of the extracted slice. |
Returns
Type | Description |
---|---|
Seq | A new Seq instance containing the elements in the
specified |
Sort<TElement>(Comparison<TElement>)
Sorts sequence elements using the specified comparison
function.
Declaration
public void Sort<TElement>(Comparison<TElement> comparison)
where TElement : struct
Parameters
Type | Name | Description |
---|---|---|
Comparison<TElement> | comparison | The comparison function that returns negative, zero or positive value depending on the relationships among the elements. |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements in the sequence. |
ToArray<TElement>()
Copies the elements of the sequence to a new array.
Declaration
public TElement[] ToArray<TElement>()
where TElement : struct
Returns
Type | Description |
---|---|
TElement[] | A new array instance containing all the elements in the sequence. |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements in the sequence. |