Search Results for

    Show / Hide Table of Contents

    Class Arr

    Represents an arbitrary array-like data structure.

    Inheritance
    Object
    CVHandle
    Arr
    IplImage
    Mat
    MatND
    SparseMat
    Namespace: OpenCV.Net
    Assembly: OpenCV.Net.dll
    Syntax
    public abstract class Arr : CVHandle

    Properties

    | Improve this Doc View Source

    ElementType

    Gets the type of array elements.

    Declaration
    public int ElementType { get; }
    Property Value
    Type Description
    Int32
    | Improve this Doc View Source

    Item[Int32]

    Gets or sets a specific array element.

    Declaration
    public Scalar this[int index] { get; set; }
    Parameters
    Type Name Description
    Int32 index

    The zero-based element index.

    Property Value
    Type Description
    Scalar

    The array element specified by index.

    Remarks

    This method can be used for sequential access to 1D, 2D or nD dense arrays. The method can be used for sparse arrays as well; if the requested node does not exist, it is created and set to zero.

    | Improve this Doc View Source

    Item[Int32, Int32]

    Gets or sets a specific array element.

    Declaration
    public Scalar this[int index0, int index1] { get; set; }
    Parameters
    Type Name Description
    Int32 index0

    The zero-based element index on the first array dimension.

    Int32 index1

    The zero-based element index on the second array dimension.

    Property Value
    Type Description
    Scalar

    The array element specified by index0 and index1.

    Remarks

    The array must have two dimensions. The method can be used for sparse arrays as well; if the requested node does not exist, it is created and set to zero.

    | Improve this Doc View Source

    Item[Int32, Int32, Int32]

    Gets or sets a specific array element.

    Declaration
    public Scalar this[int index0, int index1, int index2] { get; set; }
    Parameters
    Type Name Description
    Int32 index0

    The zero-based element index on the first array dimension.

    Int32 index1

    The zero-based element index on the second array dimension.

    Int32 index2

    The zero-based element index on the third array dimension.

    Property Value
    Type Description
    Scalar

    The array element specified by index0, index1 and index2.

    Remarks

    The array must have three dimensions. The method can be used for sparse arrays as well; if the requested node does not exist, it is created and set to zero.

    | Improve this Doc View Source

    Item[Int32[]]

    Gets or sets a specific array element.

    Declaration
    public Scalar this[params int[] index] { get; set; }
    Parameters
    Type Name Description
    Int32[] index

    An array specifying the zero-based multi-dimensional element index. The length of index must be the same as the number of dimensions of this instance.

    Property Value
    Type Description
    Scalar

    The array element specified by the multi-dimensional index.

    Remarks

    The method can be used for sparse arrays as well; if the requested node does not exist, it is created and set to zero.

    | Improve this Doc View Source

    Size

    Gets the pixel-accurate size of the array.

    Declaration
    public Size Size { get; }
    Property Value
    Type Description
    Size

    Methods

    | Improve this Doc View Source

    CheckRange(CheckArrayFlags, Double, Double)

    Checks that every array element is neither NaN nor Infinity. It can also check whether the elements are within a specified range.

    Declaration
    public bool CheckRange(CheckArrayFlags flags, double minVal, double maxVal)
    Parameters
    Type Name Description
    CheckArrayFlags flags

    The operation flags. A combination of CheckNanInfinity and CheckRange. If the latter is set, the function checks whether every value of the array is greater than or equal to minVal and less than maxVal. If CheckQuiet is set, the function does not raise an error if an element is invalid or out of range.

    Double minVal

    The inclusive lower boundary of valid values range.

    Double maxVal

    The exclusive upper boundary of valid values range.

    Returns
    Type Description
    Boolean

    true if all array elements are valid and within range; false otherwise.

    | Improve this Doc View Source

    ClearND(Int32[])

    Clears a specific element of a multi-dimensional array. If the array is dense, the element is set to zero; in case of sparse arrays, it deletes the specified node.

    Declaration
    public void ClearND(params int[] index)
    Parameters
    Type Name Description
    Int32[] index

    An array specifying the zero-based multi-dimensional index of the element to be cleared.

    | Improve this Doc View Source

    GetCol(Int32)

    Returns a single column of the current matrix as a new Mat. No data is copied.

    Declaration
    public Mat GetCol(int col)
    Parameters
    Type Name Description
    Int32 col

    Zero-based index of the selected column.

    Returns
    Type Description
    Mat

    A new Mat that corresponds to the selected column of the current matrix.

    | Improve this Doc View Source

    GetCols(Int32, Int32)

    Returns a column span of the current matrix as a new Mat. No data is copied.

    Declaration
    public Mat GetCols(int startCol, int endCol)
    Parameters
    Type Name Description
    Int32 startCol

    Zero-based index of the starting column (inclusive) of the span.

    Int32 endCol

    Zero-based index of the ending column (exclusive) of the span

    Returns
    Type Description
    Mat

    The multi-column matrix containing the column span.

    | Improve this Doc View Source

    GetDiag(Int32)

    Returns a specified diagonal of the current matrix.

    Declaration
    public Mat GetDiag(int diag = 0)
    Parameters
    Type Name Description
    Int32 diag

    The selected array diagonal. Zero corresponds to the main diagonal, negative one corresponds to the diagonal above the main, positive one corresponds to the diagonal below the main, and so forth.

    Returns
    Type Description
    Mat

    A new Mat that corresponds to the specified diagonal of the current matrix.

    | Improve this Doc View Source

    GetDims(Int32[])

    Returns the number of array dimensions and their sizes.

    Declaration
    public int GetDims(int[] sizes = null)
    Parameters
    Type Name Description
    Int32[] sizes

    The optional output array of the dimension sizes. For 2D arrays the number of rows (height) goes first and the number of columns (width) goes next.

    Returns
    Type Description
    Int32

    The number of array dimensions.

    | Improve this Doc View Source

    GetDimSize(Int32)

    Returns the size of a particular array dimension.

    Declaration
    public int GetDimSize(int index)
    Parameters
    Type Name Description
    Int32 index

    The zero-based dimension index. For matrices, zero means number of rows and one means number of columns; for images zero means height and one means width.

    Returns
    Type Description
    Int32

    The number of elements in a particular array dimension.

    | Improve this Doc View Source

    GetImage()

    Returns image header for arbitrary array.

    Declaration
    public IplImage GetImage()
    Returns
    Type Description
    IplImage

    An image header for the array which can be an image or matrix.

    | Improve this Doc View Source

    GetMat(Boolean)

    Returns matrix header for arbitrary array.

    Declaration
    public Mat GetMat(bool allowND = false)
    Parameters
    Type Name Description
    Boolean allowND

    If true, the function accepts multi-dimensional dense arrays of type MatND and returns a 2D matrix if the MatND has two dimensions or 1D matrix otherwise. The array must be continuous.

    Returns
    Type Description
    Mat

    A matrix header for the array which can be an image, matrix or multi-dimensional dense array.

    | Improve this Doc View Source

    GetRawData(out IntPtr)

    Retrieves low-level information about the array.

    Declaration
    public void GetRawData(out IntPtr data)
    Parameters
    Type Name Description
    IntPtr data

    Output pointer to the whole image origin or ROI origin if ROI is set.

    | Improve this Doc View Source

    GetRawData(out IntPtr, out Int32)

    Retrieves low-level information about the array.

    Declaration
    public void GetRawData(out IntPtr data, out int step)
    Parameters
    Type Name Description
    IntPtr data

    Output pointer to the whole image origin or ROI origin if ROI is set.

    Int32 step

    Output full row length in bytes.

    | Improve this Doc View Source

    GetRawData(out IntPtr, out Int32, out Size)

    Retrieves low-level information about the array.

    Declaration
    public void GetRawData(out IntPtr data, out int step, out Size roiSize)
    Parameters
    Type Name Description
    IntPtr data

    Output pointer to the whole image origin or ROI origin if ROI is set.

    Int32 step

    Output full row length in bytes.

    Size roiSize

    Output pixel-accurate ROI size.

    | Improve this Doc View Source

    GetReal(Int32)

    Returns a specific element of single-channel array.

    Declaration
    public double GetReal(int index)
    Parameters
    Type Name Description
    Int32 index

    The zero-based element index.

    Returns
    Type Description
    Double

    The array element specified by index.

    Remarks

    This method can be used for sequential access to 1D, 2D or nD dense arrays. The method can be used for sparse arrays as well; if the requested node does not exist, it is created and set to zero.

    | Improve this Doc View Source

    GetReal(Int32, Int32)

    Returns a specific element of single-channel array.

    Declaration
    public double GetReal(int index0, int index1)
    Parameters
    Type Name Description
    Int32 index0

    The zero-based element index on the first array dimension.

    Int32 index1

    The zero-based element index on the second array dimension.

    Returns
    Type Description
    Double

    The array element specified by index0 and index1.

    Remarks

    The array must have two dimensions. The method can be used for sparse arrays as well; if the requested node does not exist, it is created and set to zero.

    | Improve this Doc View Source

    GetReal(Int32, Int32, Int32)

    Returns a specific element of single-channel array.

    Declaration
    public double GetReal(int index0, int index1, int index2)
    Parameters
    Type Name Description
    Int32 index0

    The zero-based element index on the first array dimension.

    Int32 index1

    The zero-based element index on the second array dimension.

    Int32 index2

    The zero-based element index on the third array dimension.

    Returns
    Type Description
    Double

    The array element specified by index0, index1 and index2.

    Remarks

    The array must have three dimensions. The method can be used for sparse arrays as well; if the requested node does not exist, it is created and set to zero.

    | Improve this Doc View Source

    GetReal(Int32[])

    Returns a specific element of single-channel array.

    Declaration
    public double GetReal(params int[] index)
    Parameters
    Type Name Description
    Int32[] index

    An array specifying the zero-based multi-dimensional element index. The length of index must be the same as the number of dimensions of this instance.

    Returns
    Type Description
    Double

    The array element specified by the multi-dimensional index.

    Remarks

    The method can be used for sparse arrays as well; if the requested node does not exist, it is created and set to zero.

    | Improve this Doc View Source

    GetRow(Int32)

    Returns a single row of the current matrix as a new Mat. No data is copied.

    Declaration
    public Mat GetRow(int row)
    Parameters
    Type Name Description
    Int32 row

    Zero-based index of the selected row.

    Returns
    Type Description
    Mat

    A new Mat that corresponds to the selected row of the current matrix.

    | Improve this Doc View Source

    GetRows(Int32, Int32, Int32)

    Returns a row span of the current matrix as a new Mat. No data is copied.

    Declaration
    public Mat GetRows(int startRow, int endRow, int deltaRow = 1)
    Parameters
    Type Name Description
    Int32 startRow

    Zero-based index of the starting row (inclusive) of the span.

    Int32 endRow

    Zero-based index of the ending row (exclusive) of the span

    Int32 deltaRow

    Index step in the row span.

    Returns
    Type Description
    Mat

    The multi-row matrix containing the row span.

    | Improve this Doc View Source

    GetSubRect(Rect)

    Creates a new Mat from a subrectangle of the current instance. No data is copied.

    Declaration
    public Mat GetSubRect(Rect rect)
    Parameters
    Type Name Description
    Rect rect

    Zero-based coordinates of the rectangle of interest.

    Returns
    Type Description
    Mat

    A new Mat that corresponds to the specified rectangle of the current matrix.

    | Improve this Doc View Source

    Ptr(Int32)

    Returns a pointer to a specific array element.

    Declaration
    public IntPtr Ptr(int index)
    Parameters
    Type Name Description
    Int32 index

    The zero-based element index.

    Returns
    Type Description
    IntPtr

    The pointer to the array element specified by index.

    Remarks

    This method can be used for sequential access to 1D, 2D or nD dense arrays. The method can be used for sparse arrays as well; if the requested node does not exist, it is created and set to zero.

    | Improve this Doc View Source

    Ptr(Int32, Int32)

    Returns a pointer to a specific array element.

    Declaration
    public IntPtr Ptr(int index0, int index1)
    Parameters
    Type Name Description
    Int32 index0

    The zero-based element index on the first array dimension.

    Int32 index1

    The zero-based element index on the second array dimension.

    Returns
    Type Description
    IntPtr

    The pointer to the array element specified by index0 and index1.

    Remarks

    The array must have two dimensions. The method can be used for sparse arrays as well; if the requested node does not exist, it is created and set to zero.

    | Improve this Doc View Source

    Ptr(Int32, Int32, Int32)

    Returns a pointer to a specific array element.

    Declaration
    public IntPtr Ptr(int index0, int index1, int index2)
    Parameters
    Type Name Description
    Int32 index0

    The zero-based element index on the first array dimension.

    Int32 index1

    The zero-based element index on the second array dimension.

    Int32 index2

    The zero-based element index on the third array dimension.

    Returns
    Type Description
    IntPtr

    The pointer to the array element specified by index0, index1 and index2.

    Remarks

    The array must have three dimensions. The method can be used for sparse arrays as well; if the requested node does not exist, it is created and set to zero.

    | Improve this Doc View Source

    Ptr(Int32, Int32, Int32, out Int32)

    Returns a pointer to a specific array element.

    Declaration
    public IntPtr Ptr(int index0, int index1, int index2, out int elementType)
    Parameters
    Type Name Description
    Int32 index0

    The zero-based element index on the first array dimension.

    Int32 index1

    The zero-based element index on the second array dimension.

    Int32 index2

    The zero-based element index on the third array dimension.

    Int32 elementType

    When this method returns, contains the type of matrix elements. This parameter is passed uninitialized.

    Returns
    Type Description
    IntPtr

    The pointer to the array element specified by index0, index1 and index2.

    Remarks

    The array must have three dimensions. The method can be used for sparse arrays as well; if the requested node does not exist, it is created and set to zero.

    | Improve this Doc View Source

    Ptr(Int32, Int32, out Int32)

    Returns a pointer to a specific array element.

    Declaration
    public IntPtr Ptr(int index0, int index1, out int elementType)
    Parameters
    Type Name Description
    Int32 index0

    The zero-based element index on the first array dimension.

    Int32 index1

    The zero-based element index on the second array dimension.

    Int32 elementType

    When this method returns, contains the type of matrix elements. This parameter is passed uninitialized.

    Returns
    Type Description
    IntPtr

    The pointer to the array element specified by index0 and index1.

    Remarks

    The array must have two dimensions. The method can be used for sparse arrays as well; if the requested node does not exist, it is created and set to zero.

    | Improve this Doc View Source

    Ptr(Int32, out Int32)

    Returns a pointer to a specific array element.

    Declaration
    public IntPtr Ptr(int index, out int elementType)
    Parameters
    Type Name Description
    Int32 index

    The zero-based element index.

    Int32 elementType

    When this method returns, contains the type of matrix elements. This parameter is passed uninitialized.

    Returns
    Type Description
    IntPtr

    The pointer to the array element specified by index.

    Remarks

    This method can be used for sequential access to 1D, 2D or nD dense arrays. The method can be used for sparse arrays as well; if the requested node does not exist, it is created and set to zero.

    | Improve this Doc View Source

    Ptr(Int32[])

    Returns a pointer to a specific array element.

    Declaration
    public IntPtr Ptr(int[] index)
    Parameters
    Type Name Description
    Int32[] index

    An array specifying the zero-based multi-dimensional element index. The length of index must be the same as the number of dimensions of this instance.

    Returns
    Type Description
    IntPtr

    The pointer to the array element specified by the multi-dimensional index.

    Remarks

    The method can be used for sparse arrays as well; if the requested node does not exist, it is created and set to zero.

    | Improve this Doc View Source

    Ptr(Int32[], out Int32, Boolean)

    Returns a pointer to a specific array element.

    Declaration
    public IntPtr Ptr(int[] index, out int elementType, bool createNode = true)
    Parameters
    Type Name Description
    Int32[] index

    An array specifying the zero-based multi-dimensional element index. The length of index must be the same as the number of dimensions of this instance.

    Int32 elementType

    When this method returns, contains the type of matrix elements. This parameter is passed uninitialized.

    Boolean createNode

    Optional parameter for sparse arrays only. true means that the requested element is created if it does not exist already; otherwise, the array will not be changed.

    Returns
    Type Description
    IntPtr

    The pointer to the array element specified by the multi-dimensional index.

    | Improve this Doc View Source

    Reshape(Int32, Int32)

    Changes shape of matrix/image without copying data.

    Declaration
    public Mat Reshape(int channels, int rows = 0)
    Parameters
    Type Name Description
    Int32 channels

    The new number of channels. Zero means that the number of channels remains unchanged.

    Int32 rows

    The new number of rows. Zero means that the number of rows remains unchanged unless it needs to be changed according to channels.

    Returns
    Type Description
    Mat

    A new matrix header for the array with the newly specified shape.

    | Improve this Doc View Source

    Set(Scalar, Arr)

    Sets every element of the array to a given value.

    Declaration
    public void Set(Scalar value, Arr mask = null)
    Parameters
    Type Name Description
    Scalar value

    The fill value.

    Arr mask

    Optional operation mask, 8-bit single-channel array specifying the elements that should be changed.

    | Improve this Doc View Source

    SetData(IntPtr, Int32)

    Assigns the specified user data pointer to the array header.

    Declaration
    public void SetData(IntPtr data, int step)
    Parameters
    Type Name Description
    IntPtr data

    The user data pointer to the raw element data.

    Int32 step

    The full row length in bytes.

    | Improve this Doc View Source

    SetReal(Int32, Double)

    Sets a specific element of single-channel array.

    Declaration
    public void SetReal(int index, double value)
    Parameters
    Type Name Description
    Int32 index

    The zero-based element index.

    Double value

    The assigned value.

    Remarks

    The method can be used for sparse arrays as well; if the node does not exist, it is created and set to the specified value.

    | Improve this Doc View Source

    SetReal(Int32, Int32, Double)

    Sets a specific element of single-channel array.

    Declaration
    public void SetReal(int index0, int index1, double value)
    Parameters
    Type Name Description
    Int32 index0

    The zero-based element index on the first array dimension.

    Int32 index1

    The zero-based element index on the second array dimension.

    Double value

    The assigned value.

    Remarks

    The method can be used for sparse arrays as well; if the node does not exist, it is created and set to the specified value.

    | Improve this Doc View Source

    SetReal(Int32, Int32, Int32, Double)

    Sets a specific element of single-channel array.

    Declaration
    public void SetReal(int index0, int index1, int index2, double value)
    Parameters
    Type Name Description
    Int32 index0

    The zero-based element index on the first array dimension.

    Int32 index1

    The zero-based element index on the second array dimension.

    Int32 index2

    The zero-based element index on the third array dimension.

    Double value

    The assigned value.

    Remarks

    The method can be used for sparse arrays as well; if the node does not exist, it is created and set to the specified value.

    | Improve this Doc View Source

    SetReal(Int32[], Double)

    Sets a specific element of single-channel array.

    Declaration
    public void SetReal(int[] index, double value)
    Parameters
    Type Name Description
    Int32[] index

    An array specifying the zero-based multi-dimensional element index. The length of index must be the same as the number of dimensions of this instance.

    Double value

    The assigned value.

    Remarks

    The method can be used for sparse arrays as well; if the node does not exist, it is created and set to the specified value.

    | Improve this Doc View Source

    SetZero()

    Clears the array. In the case of dense arrays, all elements are set to zero; for sparse arrays all the elements are removed.

    Declaration
    public void SetZero()
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX