Table of Contents

Class Mat<TElem>

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

Type-specific matrix. TElem fixes the element type, so elements can be read and written as TElem (e.g. via mat[row, col]) and the matrix can be enumerated.

public class Mat<TElem> : Mat, IDisposable, IEnumerable<TElem>, IEnumerable where TElem : unmanaged

Type Parameters

TElem

Element Type

Inheritance
Mat<TElem>
Implements
Inherited Members
Extension Methods

Constructors

Mat()

Creates empty Mat

Mat(Mat)

Initializes by Mat object. The Mat's element type must match TElem.

Mat(Mat<TElem>, Range, Range?)

creates a matrix header for a part of the bigger matrix

Mat(Mat<TElem>, Range[])

creates a matrix header for a part of the bigger matrix

Mat(Mat<TElem>, Rect)

creates a matrix header for a part of the bigger matrix

Mat(Size)

constructs 2D matrix of the specified size and type

Mat(Size, Scalar)

constructs 2D matrix and fills it with the specified Scalar value.

Mat(IEnumerable<int>)

constructs n-dimensional matrix

Mat(IEnumerable<int>, Scalar)

constructs n-dimensional matrix

Mat(IEnumerable<int>, Array, IEnumerable<long>?)

constructor for matrix headers pointing to user-allocated data

Mat(int, int)

constructs 2D matrix of the specified size and type

Mat(int, int, Scalar)

constructs 2D matrix and fills it with the specified Scalar value.

Mat(int, int, Array, long)

constructor for matrix headers pointing to user-allocated data

Properties

this[Range, Range]

Extracts a rectangular submatrix.

this[Range[]]

Extracts a rectangular submatrix.

this[Rect]

Extracts a rectangular submatrix.

this[int, int]

Gets or sets the element at the specified 2-D position.

this[int, int, int, int]

Extracts a rectangular submatrix.

Methods

Clone()

Creates a full copy of the matrix.

FromNativePointer(nint)

Creates from native cv::Mat* pointer

FromPixelData(IEnumerable<int>, nint, IEnumerable<long>?)

constructor for matrix headers pointing to user-allocated data

FromPixelData(int, int, Array, long)

constructor for matrix headers pointing to user-allocated data

FromPixelData(int, int, nint, long)

constructor for matrix headers pointing to user-allocated data

GetEnumerator()

Enumerates all elements in row-major order (works for any dimensionality).

GetIndexer()

Gets a type-specific indexer for fast repeated element access. The indexer captures the data pointer once, so it is faster than this[row, col] for tight loops.

Reshape(int)

Changes the shape of channels of a 2D matrix without copying the data.

Reshape(int[])

Changes the shape of a 2D matrix without copying the data.

SubMat(Range, Range)

Extracts a rectangular submatrix.

SubMat(Range[])

Extracts a rectangular submatrix.

SubMat(Rect)

Extracts a rectangular submatrix.

SubMat(int, int, int, int)

Extracts a rectangular submatrix.

T()

Transposes a matrix.

ToArray()

Convert this mat to managed array

ToRectangularArray()

Convert this mat to managed rectangular array

Wrap(Mat)