OpenCV for Unity 2.6.5
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.10.0/index.html ) for the details of the argument of the method.
Loading...
Searching...
No Matches
OpenCVForUnity.CoreModule.Mat Class Reference

n-dimensional dense array class More...

Public Member Functions

 Mat ()
 
 Mat (in Vec2d size, int type)
 
 Mat (in Vec2d size, int type, in Vec4d s)
 
 Mat (in Vec2d size, int type, IntPtr data, long step=AUTO_STEP)
 
 Mat (in(double width, double height) size, int type)
 
 Mat (in(double width, double height) size, int type, in(double v0, double v1, double v2, double v3) s)
 
 Mat (in(double width, double height) size, int type, IntPtr data, long step=AUTO_STEP)
 
 Mat (int rows, int cols, int type)
 
 Mat (int rows, int cols, int type, in Vec4d s)
 
 Mat (int rows, int cols, int type, in(double v0, double v1, double v2, double v3) s)
 
 Mat (int rows, int cols, int type, IntPtr data, long step=AUTO_STEP)
 
 Mat (int rows, int cols, int type, Scalar s)
 
 Mat (int[] sizes, int type)
 
 Mat (int[] sizes, int type, in Vec4d s)
 
 Mat (int[] sizes, int type, in(double v0, double v1, double v2, double v3) s)
 
 Mat (int[] sizes, int type, Scalar s)
 
 Mat (IntPtr addr)
 
 Mat (Mat m, in Vec2i rowRange)
 
 Mat (Mat m, in Vec2i rowRange, in Vec2i colRange)
 
 Mat (Mat m, in Vec2i[] ranges)
 
 Mat (Mat m, in Vec4i roi)
 
 Mat (Mat m, in(int start, int end) rowRange)
 
 Mat (Mat m, in(int start, int end) rowRange, in(int start, int end) colRange)
 
 Mat (Mat m, in(int start, int end)[] ranges)
 
 Mat (Mat m, in(int x, int y, int width, int height) roi)
 
 Mat (Mat m, Range rowRange)
 
 Mat (Mat m, Range rowRange, Range colRange)
 
 Mat (Mat m, Range[] ranges)
 
 Mat (Mat m, Rect roi)
 
 Mat (Size size, int type)
 
 Mat (Size size, int type, IntPtr data, long step=AUTO_STEP)
 
 Mat (Size size, int type, Scalar s)
 
Mat adjustROI (int dtop, int dbottom, int dleft, int dright)
 Adjusts a submatrix size and position within the parent matrix.
 
void assignTo (Mat m)
 Provides a functional form of convertTo.
 
void assignTo (Mat m, int type)
 Provides a functional form of convertTo.
 
Span< T > AsSpan< T > ()
 Creates and returns a Span<T> representing the entire data of the Mat object.
 
Span< T > AsSpan< T > (int i0)
 Creates and returns a Span<T> representing the data in the specified row or dimension of the Mat object.
 
Span< T > AsSpan< T > (int i0, int i1)
 Creates and returns a Span<T> representing the data at the specified row and column, or dimensions, of the Mat object.
 
Span< T > AsSpan< T > (int i0, int i1, int i2)
 Creates and returns a Span<T> representing the data at the specified element in the Mat object, starting from the given three-dimensional indices.
 
Span< T > AsSpan< T > (params int[] idx)
 Creates and returns a Span<T> representing the data at the specified element in the Mat object based on a variable number of indices.
 
Span< T > AsSpanRowRange< T > (int startrow, int endrow)
 Creates and returns a Span<T> representing the data in the specified range of rows in the Mat object.
 
Span< T > AsSpanRowRange< T > (Range r)
 Creates and returns a Span<T> representing a range of rows from the Mat object, defined by the specified Range.
 
Span< T > at< T > (int i0)
 Creates and returns a Span<T> representing the first element in the specified row of the Mat object.
 
Span< T > at< T > (int i0, int i1)
 Creates and returns a Span<T> representing the first element in the specified row and column of the Mat object.
 
Span< T > at< T > (int i0, int i1, int i2)
 Creates and returns a Span<T> representing the first element in the specified row, column, and third dimension of the Mat object.
 
Span< T > at< T > (params int[] idx)
 Creates and returns a Span<T> representing the first element in the specified coordinates of the Mat object.
 
int channels ()
 Returns the number of matrix channels.
 
int checkVector (int elemChannels)
 
int checkVector (int elemChannels, int depth)
 
int checkVector (int elemChannels, int depth, bool requireContinuous)
 
Mat clone ()
 Creates a full copy of the array and the underlying data.
 
Mat col (int x)
 Creates a matrix header for the specified matrix column.
 
Mat colRange (in Vec2i r)
 Creates a matrix header for the specified column span.
 
Mat colRange (in(int start, int end) r)
 Creates a matrix header for the specified column span.
 
Mat colRange (int startcol, int endcol)
 Creates a matrix header for the specified column span.
 
Mat colRange (Range r)
 Creates a matrix header for the specified column span.
 
int cols ()
 
void convertTo (Mat m, int rtype)
 Converts an array to another data type with optional scaling.
 
void convertTo (Mat m, int rtype, double alpha)
 Converts an array to another data type with optional scaling.
 
void convertTo (Mat m, int rtype, double alpha, double beta)
 Converts an array to another data type with optional scaling.
 
void copySize (Mat m)
 
void copyTo (Mat m)
 Copies the matrix to another one.
 
void copyTo (Mat m, Mat mask)
 Copies the matrix to another one.
 
void create (in Vec2d size, int type)
 Allocates new array data if needed.
 
void create (in(double width, double height) size, int type)
 Allocates new array data if needed.
 
void create (int rows, int cols, int type)
 Allocates new array data if needed.
 
void create (int[] sizes, int type)
 Allocates new array data if needed.
 
void create (Size size, int type)
 Allocates new array data if needed.
 
Mat cross (Mat m)
 Computes a cross-product of two 3-element vectors.
 
long dataAddr ()
 Returns the first pointer address of Mat data.
 
int depth ()
 Returns the depth of a matrix element.
 
Mat diag ()
 Extracts a diagonal from a matrix.
 
Mat diag (int d)
 Extracts a diagonal from a matrix.
 
int dims ()
 
double dot (Mat m)
 Computes a dot-product of two vectors.
 
string dump ()
 Returns the contents of the visualized matrix in String format.
 
long elemSize ()
 Returns the matrix element size in bytes.
 
long elemSize1 ()
 Returns the size of each matrix element channel in bytes.
 
bool empty ()
 Returns true if the array has no elements.
 
double[] get (int row, int col)
 Reads the element values from the matrix at the specified row and column, returning them as an array of double values.
 
int get (int row, int col, byte[] data)
 Reads a byte array from the matrix at the specified row and column.
 
int get (int row, int col, byte[] data, int length)
 Reads a specified number of byte values from the matrix at the given row and column.
 
int get (int row, int col, byte[] data, int offset, int length)
 Reads a specified number of byte values from the matrix at the given row and column, storing them in the data array starting at the specified offset.
 
int get (int row, int col, double[] data)
 Reads a double array from the matrix at the specified row and column.
 
int get (int row, int col, double[] data, int length)
 Reads a specified number of double values from the matrix at the given row and column.
 
int get (int row, int col, double[] data, int offset, int length)
 Reads a specified number of double values from the matrix at the given row and column, storing them in the data array starting at the specified offset.
 
int get (int row, int col, float[] data)
 Reads a float array from the matrix at the specified row and column.
 
int get (int row, int col, float[] data, int length)
 Reads a specified number of float values from the matrix at the given row and column.
 
int get (int row, int col, float[] data, int offset, int length)
 Reads a specified number of float values from the matrix at the given row and column, storing them in the data array starting at the specified offset.
 
int get (int row, int col, int[] data)
 Reads an int array from the matrix at the specified row and column.
 
int get (int row, int col, int[] data, int length)
 Reads a specified number of int values from the matrix at the given row and column.
 
int get (int row, int col, int[] data, int offset, int length)
 Reads a specified number of int values from the matrix at the given row and column, storing them in the data array starting at the specified offset.
 
int get (int row, int col, sbyte[] data)
 Reads a sbyte array from the matrix at the specified row and column.
 
int get (int row, int col, sbyte[] data, int length)
 Reads a specified number of sbyte values from the matrix at the given row and column.
 
int get (int row, int col, sbyte[] data, int offset, int length)
 Reads a specified number of sbyte values from the matrix at the given row and column, storing them in the data array starting at the specified offset.
 
int get (int row, int col, short[] data)
 Reads a short array from the matrix at the specified row and column.
 
int get (int row, int col, short[] data, int length)
 Reads a specified number of short values from the matrix at the given row and column.
 
int get (int row, int col, short[] data, int offset, int length)
 Reads a specified number of short values from the matrix at the given row and column, storing them in the data array starting at the specified offset.
 
int get (int row, int col, Span< byte > data)
 Reads a span of byte data from the matrix at the specified row and column.
 
int get (int row, int col, Span< byte > data, int length)
 Reads a span of byte data from the matrix at the specified row and column.
 
int get (int row, int col, Span< byte > data, int offset, int length)
 Reads a span of byte data from the matrix at the specified row and column, storing them in the data span starting at the specified offset.
 
int get (int row, int col, Span< double > data)
 Reads a span of double data from the matrix at the specified row and column.
 
int get (int row, int col, Span< double > data, int length)
 Reads a span of double data from the matrix at the specified row and column.
 
int get (int row, int col, Span< double > data, int offset, int length)
 Reads a span of double data from the matrix at the specified row and column, storing them in the data span starting at the specified offset.
 
int get (int row, int col, Span< float > data)
 Reads a span of float data from the matrix at the specified row and column.
 
int get (int row, int col, Span< float > data, int length)
 Reads a span of float data from the matrix at the specified row and column.
 
int get (int row, int col, Span< float > data, int offset, int length)
 Reads a span of float data from the matrix at the specified row and column, storing them in the data span starting at the specified offset.
 
int get (int row, int col, Span< int > data)
 Reads a span of int data from the matrix at the specified row and column.
 
int get (int row, int col, Span< int > data, int length)
 Reads a span of int data from the matrix at the specified row and column.
 
int get (int row, int col, Span< int > data, int offset, int length)
 Reads a span of int data from the matrix at the specified row and column, storing them in the data span starting at the specified offset.
 
int get (int row, int col, Span< sbyte > data)
 Reads a span of sbyte data from the matrix at the specified row and column.
 
int get (int row, int col, Span< sbyte > data, int length)
 Reads a span of sbyte data from the matrix at the specified row and column.
 
int get (int row, int col, Span< sbyte > data, int offset, int length)
 Reads a span of sbyte data from the matrix at the specified row and column, storing them in the data span starting at the specified offset.
 
int get (int row, int col, Span< short > data)
 Reads a span of short data from the matrix at the specified row and column.
 
int get (int row, int col, Span< short > data, int length)
 Reads a span of short data from the matrix at the specified row and column.
 
int get (int row, int col, Span< short > data, int offset, int length)
 Reads a span of short data from the matrix at the specified row and column, storing them in the data span starting at the specified offset.
 
int get (int row, int col, Span< ushort > data)
 Reads a span of ushort data from the matrix at the specified row and column.
 
int get (int row, int col, Span< ushort > data, int length)
 Reads a span of ushort data from the matrix at the specified row and column.
 
int get (int row, int col, Span< ushort > data, int offset, int length)
 Reads a span of ushort data from the matrix at the specified row and column, storing them in the data span starting at the specified offset.
 
int get (int row, int col, ushort[] data)
 Reads an ushort array from the matrix at the specified row and column.
 
int get (int row, int col, ushort[] data, int length)
 Reads a specified number of ushort values from the matrix at the given row and column.
 
int get (int row, int col, ushort[] data, int offset, int length)
 Reads a specified number of ushort values from the matrix at the given row and column, storing them in the data array starting at the specified offset.
 
double[] get (int[] idx)
 Reads the element values from the matrix at the specified indices, returning them as an array of double values.
 
int get (int[] idx, byte[] data)
 Reads a byte array from the matrix at the specified indices.
 
int get (int[] idx, byte[] data, int length)
 Reads a specified number of byte values from the matrix at the given indices.
 
int get (int[] idx, byte[] data, int offset, int length)
 Reads a specified number of byte values from the matrix at the given indices, storing them in the data array starting at the specified offset.
 
int get (int[] idx, double[] data)
 Reads a double array from the matrix at the specified indices.
 
int get (int[] idx, double[] data, int length)
 Reads a specified number of double values from the matrix at the given indices.
 
int get (int[] idx, double[] data, int offset, int length)
 Reads a specified number of double values from the matrix at the given indices, storing them in the data array starting at the specified offset.
 
int get (int[] idx, float[] data)
 Reads a float array from the matrix at the specified indices.
 
int get (int[] idx, float[] data, int length)
 Reads a specified number of float values from the matrix at the given indices.
 
int get (int[] idx, float[] data, int offset, int length)
 Reads a specified number of float values from the matrix at the given indices, storing them in the data array starting at the specified offset.
 
int get (int[] idx, int[] data)
 Reads an int array from the matrix at the specified indices.
 
int get (int[] idx, int[] data, int length)
 Reads a specified number of int values from the matrix at the given indices.
 
int get (int[] idx, int[] data, int offset, int length)
 Reads a specified number of int values from the matrix at the given indices, storing them in the data array starting at the specified offset.
 
int get (int[] idx, sbyte[] data)
 Reads a sbyte array from the matrix at the specified indices.
 
int get (int[] idx, sbyte[] data, int length)
 Reads a specified number of sbyte values from the matrix at the given indices.
 
int get (int[] idx, sbyte[] data, int offset, int length)
 Reads a specified number of sbyte values from the matrix at the given indices, storing them in the data array starting at the specified offset.
 
int get (int[] idx, short[] data)
 Reads a short array from the matrix at the specified indices.
 
int get (int[] idx, short[] data, int length)
 Reads a specified number of short values from the matrix at the given indices.
 
int get (int[] idx, short[] data, int offset, int length)
 Reads a specified number of short values from the matrix at the given indices, storing them in the data array starting at the specified offset.
 
int get (int[] idx, Span< byte > data)
 Reads a span of byte data from the matrix at the specified indices.
 
int get (int[] idx, Span< byte > data, int length)
 Reads a span of byte data from the matrix at the specified indices.
 
int get (int[] idx, Span< byte > data, int offset, int length)
 Reads a span of byte data from the matrix at the specified indices, storing them in the data span starting at the specified offset.
 
int get (int[] idx, Span< double > data)
 Reads a span of double data from the matrix at the specified indices.
 
int get (int[] idx, Span< double > data, int length)
 Reads a span of double data from the matrix at the specified indices.
 
int get (int[] idx, Span< double > data, int offset, int length)
 Reads a span of double data from the matrix at the specified indices, storing them in the data span starting at the specified offset.
 
int get (int[] idx, Span< float > data)
 Reads a span of float data from the matrix at the specified indices.
 
int get (int[] idx, Span< float > data, int length)
 Reads a span of float data from the matrix at the specified indices.
 
int get (int[] idx, Span< float > data, int offset, int length)
 Reads a span of float data from the matrix at the specified indices, storing them in the data span starting at the specified offset.
 
int get (int[] idx, Span< int > data)
 Reads a span of int data from the matrix at the specified indices.
 
int get (int[] idx, Span< int > data, int length)
 Reads a span of int data from the matrix at the specified indices.
 
int get (int[] idx, Span< int > data, int offset, int length)
 Reads a span of int data from the matrix at the specified indices, storing them in the data span starting at the specified offset.
 
int get (int[] idx, Span< sbyte > data)
 Reads a span of sbyte data from the matrix at the specified indices.
 
int get (int[] idx, Span< sbyte > data, int length)
 Reads a span of sbyte data from the matrix at the specified indices.
 
int get (int[] idx, Span< sbyte > data, int offset, int length)
 Reads a span of sbyte data from the matrix at the specified indices, storing them in the data span starting at the specified offset.
 
int get (int[] idx, Span< short > data)
 Reads a span of short data from the matrix at the specified indices.
 
int get (int[] idx, Span< short > data, int length)
 Reads a span of short data from the matrix at the specified indices.
 
int get (int[] idx, Span< short > data, int offset, int length)
 Reads a span of short data from the matrix at the specified indices, storing them in the data span starting at the specified offset.
 
int get (int[] idx, Span< ushort > data)
 Reads a ushort of byte data from the matrix at the specified indices.
 
int get (int[] idx, Span< ushort > data, int length)
 Reads a span of ushort data from the matrix at the specified indices.
 
int get (int[] idx, Span< ushort > data, int offset, int length)
 Reads a span of ushort data from the matrix at the specified indices, storing them in the data span starting at the specified offset.
 
int get (int[] idx, ushort[] data)
 Reads an ushort array from the matrix at the specified indices.
 
int get (int[] idx, ushort[] data, int length)
 Reads a specified number of ushort values from the matrix at the given indices.
 
int get (int[] idx, ushort[] data, int offset, int length)
 Reads a specified number of ushort values from the matrix at the given indices, storing them in the data array starting at the specified offset.
 
T[] get< T > (int row, int col)
 Reads the element values from the matrix at the specified row and column, returning them as an array of type T .
 
int get< T > (int row, int col, Span< T > data)
 Reads a span of type T from the matrix at the specified row and column.
 
int get< T > (int row, int col, Span< T > data, int length)
 Reads a span of type T from the matrix at the specified row and column.
 
int get< T > (int row, int col, Span< T > data, int offset, int length)
 Reads a span of type T from the matrix at the specified row and column, storing them in the data span starting at the specified offset.
 
int get< T > (int row, int col, T[] data)
 Reads an array of type T from the matrix at the specified row and column.
 
int get< T > (int row, int col, T[] data, int length)
 Reads an array of type T from the matrix at the specified row and column.
 
int get< T > (int row, int col, T[] data, int offset, int length)
 Reads an array of type T from the matrix at the specified row and column, storing them in the data array starting at the specified offset.
 
T[] get< T > (int[] idx)
 Reads the element values from the matrix at the specified indices, returning them as an array of type T .
 
int get< T > (int[] idx, Span< T > data)
 Reads a span of type T from the matrix at the specified indices.
 
int get< T > (int[] idx, Span< T > data, int length)
 Reads a span of type T from the matrix at the specified indices.
 
int get< T > (int[] idx, Span< T > data, int offset, int length)
 Reads a span of type T from the matrix at the specified indices, storing them in the data span starting at the specified offset.
 
int get< T > (int[] idx, T[] data)
 Reads an array of type T from the matrix at the specified indices.
 
int get< T > (int[] idx, T[] data, int length)
 Reads an array of type T from the matrix at the specified indices.
 
int get< T > (int[] idx, T[] data, int offset, int length)
 Reads an array of type T from the matrix at the specified indices, storing them in the data array starting at the specified offset.
 
IntPtr getNativeObjAddr ()
 
int height ()
 Returns the number of rows in the matrix.
 
Mat inv ()
 Inverses a matrix.
 
Mat inv (int method)
 Inverses a matrix.
 
bool isContinuous ()
 Reports whether the matrix is continuous or not.
 
bool isSubmatrix ()
 
void locateROI (out Vec2d wholeSize, out Vec2d ofs)
 Locates the matrix header within a parent matrix.
 
void locateROI (out(double width, double height) wholeSize, out(double x, double y) ofs)
 Locates the matrix header within a parent matrix.
 
void locateROI (Size wholeSize, Point ofs)
 Locates the matrix header within a parent matrix.
 
Mat matMul (Mat m)
 
Mat mul (Mat m)
 Element-wise multiplication.
 
Mat mul (Mat m, double scale)
 Performs an element-wise multiplication or division of the two matrices.
 
IntPtr ptr (int i0)
 Returns a pointer to the specified row of the Mat object.
 
IntPtr ptr (int i0, int i1)
 Returns a pointer to the specified row and column of the Mat object.
 
IntPtr ptr (int i0, int i1, int i2)
 Returns a pointer to the specified element of the Mat object based on the given row, column, and third dimension indices.
 
IntPtr ptr (params int[] idx)
 Returns a pointer to the specified element of the Mat object based on the provided indices for each dimension.
 
void push_back (Mat m)
 Adds elements to the bottom of the matrix.
 
int put (int row, int col, byte[] data)
 Writes a byte array to the matrix at the specified row and column.
 
int put (int row, int col, byte[] data, int length)
 Writes a byte array to the matrix at a specified row and column.
 
int put (int row, int col, byte[] data, int offset, int length)
 Writes a specified number of byte values to the matrix at the given row and column, starting from the specified offset within the data array.
 
int put (int row, int col, double[] data, int length)
 Writes a specified number of double values to the matrix at the given row and column, casting them to match the matrix's data type.
 
int put (int row, int col, double[] data, int offset, int length)
 Writes a specified number of double values to the matrix at the given row and column, starting from the specified offset within the data array, casting them to match the matrix's data type.
 
int put (int row, int col, float[] data)
 Writes a float array to the matrix at a specified row and column.
 
int put (int row, int col, float[] data, int length)
 Writes a specified number of float values to the matrix at the given row and column.
 
int put (int row, int col, float[] data, int offset, int length)
 Writes a specified number of float values to the matrix at the given row and column, starting from the specified offset within the data array.
 
int put (int row, int col, int[] data)
 Writes an int array to the matrix at the specified row and column.
 
int put (int row, int col, int[] data, int length)
 Writes a specified number of int values to the matrix at the given row and column.
 
int put (int row, int col, int[] data, int offset, int length)
 Writes a specified number of int values to the matrix at the given row and column, starting from the specified offset within the data array.
 
int put (int row, int col, params double[] data)
 Writes a double array to the matrix at the given row and column, casting them to match the matrix's data type.
 
int put (int row, int col, sbyte[] data)
 Writes a sbyte array to the matrix at the specified row and column.
 
int put (int row, int col, sbyte[] data, int length)
 Writes a specified number of sbyte values to the matrix at the given row and column.
 
int put (int row, int col, sbyte[] data, int offset, int length)
 Writes a specified number of sbyte values to the matrix at the given row and column, starting from the specified offset within the data array.
 
int put (int row, int col, short[] data)
 Writes a short array to the matrix at the specified row and column.
 
int put (int row, int col, short[] data, int length)
 Writes a specified number of short values to the matrix at the given row and column.
 
int put (int row, int col, short[] data, int offset, int length)
 Writes a specified number of short values to the matrix at the given row and column, starting from the specified offset within the data array.
 
int put (int row, int col, Span< byte > data)
 Writes a span of byte data to the matrix at the specified row and column.
 
int put (int row, int col, Span< byte > data, int length)
 Writes a span of byte data to the matrix at the specified row and column.
 
int put (int row, int col, Span< byte > data, int offset, int length)
 Writes a span of byte data to the matrix at the specified row and column, starting from the specified offset within the data span.
 
int put (int row, int col, Span< double > data)
 Writes a span of double data to the matrix at the specified row and column, casting them to match the matrix's data type.
 
int put (int row, int col, Span< double > data, int length)
 Writes a span of double data to the matrix at the specified row and column, casting them to match the matrix's data type.
 
int put (int row, int col, Span< double > data, int offset, int length)
 Writes a span of double data to the matrix at the specified row and column, starting from the specified offset within the data array, casting them to match the matrix's data type.
 
int put (int row, int col, Span< float > data)
 Writes a span of float data to the matrix at the specified row and column.
 
int put (int row, int col, Span< float > data, int length)
 Writes a span of float data to the matrix at the specified row and column.
 
int put (int row, int col, Span< float > data, int offset, int length)
 Writes a span of float data to the matrix at the specified row and column, starting from the specified offset within the data span.
 
int put (int row, int col, Span< int > data)
 Writes a span of int data to the matrix at the specified row and column.
 
int put (int row, int col, Span< int > data, int length)
 Writes a span of int data to the matrix at the specified row and column.
 
int put (int row, int col, Span< int > data, int offset, int length)
 Writes a span of int data to the matrix at the specified row and column, starting from the specified offset within the data span.
 
int put (int row, int col, Span< sbyte > data)
 Writes a span of sbyte data to the matrix at the specified row and column.
 
int put (int row, int col, Span< sbyte > data, int length)
 Writes a span of sbyte data to the matrix at the specified row and column.
 
int put (int row, int col, Span< sbyte > data, int offset, int length)
 Writes a span of sbyte data to the matrix at the specified row and column, starting from the specified offset within the data span.
 
int put (int row, int col, Span< short > data)
 Writes a span of short data to the matrix at the specified row and column.
 
int put (int row, int col, Span< short > data, int length)
 Writes a span of short data to the matrix at the specified row and column.
 
int put (int row, int col, Span< short > data, int offset, int length)
 Writes a span of short data to the matrix at the specified row and column, starting from the specified offset within the data span.
 
int put (int row, int col, Span< ushort > data)
 Writes a span of ushort data to the matrix at the specified row and column.
 
int put (int row, int col, Span< ushort > data, int length)
 Writes a span of ushort data to the matrix at the specified row and column.
 
int put (int row, int col, Span< ushort > data, int offset, int length)
 Writes a span of ushort data to the matrix at the specified row and column, starting from the specified offset within the data span.
 
int put (int row, int col, ushort[] data)
 Writes an ushort array to the matrix at the specified row and column.
 
int put (int row, int col, ushort[] data, int length)
 Writes a specified number of ushort values to the matrix at the given row and column.
 
int put (int row, int col, ushort[] data, int offset, int length)
 Writes a specified number of ushort values to the matrix at the given row and column, starting from the specified offset within the data array.
 
int put (int[] idx, byte[] data)
 Writes a byte array to the matrix at the specified indices.
 
int put (int[] idx, byte[] data, int length)
 Writes a specified number of byte values to the matrix at the given indices.
 
int put (int[] idx, byte[] data, int offset, int length)
 Writes a specified number of byte values to the matrix at the given indices, starting from the specified offset within the data array.
 
int put (int[] idx, double[] data, int length)
 Writes a specified number of double values to the matrix at the given indices, casting them to match the matrix's data type.
 
int put (int[] idx, double[] data, int offset, int length)
 Writes a specified number of double values to the matrix at the given indices, starting from the specified offset within the data array, casting them to match the matrix's data type.
 
int put (int[] idx, float[] data)
 Writes a float array to the matrix at the specified indices.
 
int put (int[] idx, float[] data, int length)
 Writes a specified number of float values to the matrix at the given indices.
 
int put (int[] idx, float[] data, int offset, int length)
 Writes a specified number of float values to the matrix at the given indices, starting from the specified offset within the data array.
 
int put (int[] idx, int[] data)
 Writes an int array to the matrix at the specified indices.
 
int put (int[] idx, int[] data, int length)
 Writes a specified number of int values to the matrix at the given indices.
 
int put (int[] idx, int[] data, int offset, int length)
 Writes a specified number of int values to the matrix at the given indices, starting from the specified offset within the data array.
 
int put (int[] idx, params double[] data)
 Writes a double array to the matrix at the given indices, casting them to match the matrix's data type.
 
int put (int[] idx, sbyte[] data)
 Writes a sbyte array to the matrix at the specified multi-dimensional indices.
 
int put (int[] idx, sbyte[] data, int length)
 Writes a specified number of sbyte values to the matrix at the given indices.
 
int put (int[] idx, sbyte[] data, int offset, int length)
 Writes a specified number of sbyte values to the matrix at the given indices, starting from the specified offset within the data array.
 
int put (int[] idx, short[] data)
 Writes a short array to the matrix at the specified indices.
 
int put (int[] idx, short[] data, int length)
 Writes a specified number of short values to the matrix at the given indices.
 
int put (int[] idx, short[] data, int offset, int length)
 Writes a specified number of short values to the matrix at the given indices, starting from the specified offset within the data array.
 
int put (int[] idx, Span< byte > data)
 Writes a span of byte data to the matrix at the specified indices.
 
int put (int[] idx, Span< byte > data, int length)
 Writes a span of byte data to the matrix at the specified indices with a specified length.
 
int put (int[] idx, Span< byte > data, int offset, int length)
 Writes a span of byte data to the matrix at the specified indices, starting from the specified offset within the data span.
 
int put (int[] idx, Span< double > data)
 Writes a span of double data to the matrix at the specified indices, casting them to match the matrix's data type.
 
int put (int[] idx, Span< double > data, int length)
 Writes a span of double data to the matrix at the specified indices with a specified length, casting them to match the matrix's data type.
 
int put (int[] idx, Span< double > data, int offset, int length)
 Writes a span of double data to the matrix at the specified indices, starting from the specified offset within the data span, casting them to match the matrix's data type.
 
int put (int[] idx, Span< float > data)
 Writes a span of float data to the matrix at the specified indices.
 
int put (int[] idx, Span< float > data, int length)
 Writes a span of float data to the matrix at the specified indices with a specified length.
 
int put (int[] idx, Span< float > data, int offset, int length)
 Writes a span of float data to the matrix at the specified indices, starting from the specified offset within the data span.
 
int put (int[] idx, Span< int > data)
 Writes a span of int data to the matrix at the specified indices.
 
int put (int[] idx, Span< int > data, int length)
 Writes a span of int data to the matrix at the specified indices with a specified length.
 
int put (int[] idx, Span< int > data, int offset, int length)
 Writes a span of int data to the matrix at the specified indices, starting from the specified offset within the data span.
 
int put (int[] idx, Span< sbyte > data)
 Writes a span of sbyte data to the matrix at the specified indices.
 
int put (int[] idx, Span< sbyte > data, int length)
 Writes a span of sbyte data to the matrix at the specified indices with a specified length.
 
int put (int[] idx, Span< sbyte > data, int offset, int length)
 Writes a span of sbyte data to the matrix at the specified indices, starting from the specified offset within the data span.
 
int put (int[] idx, Span< short > data)
 Writes a span of short data to the matrix at the specified indices.
 
int put (int[] idx, Span< short > data, int length)
 Writes a span of short data to the matrix at the specified indices with a specified length.
 
int put (int[] idx, Span< short > data, int offset, int length)
 Writes a span of short data to the matrix at the specified indices, starting from the specified offset within the data span.
 
int put (int[] idx, Span< ushort > data)
 Writes a span of ushort data to the matrix at the specified indices.
 
int put (int[] idx, Span< ushort > data, int length)
 Writes a span of ushort data to the matrix at the specified indices with a specified length.
 
int put (int[] idx, Span< ushort > data, int offset, int length)
 Writes a span of ushort data to the matrix at the specified indices, starting from the specified offset within the data span.
 
int put (int[] idx, ushort[] data)
 Writes an ushort array to the matrix at the specified indices.
 
int put (int[] idx, ushort[] data, int length)
 Writes a specified number of ushort values to the matrix at the given indices.
 
int put (int[] idx, ushort[] data, int offset, int length)
 Writes a specified number of ushort values to the matrix at the given indices, starting from the specified offset within the data array.
 
int put< T > (int row, int col, Span< T > data)
 Writes a span of type T to the matrix at the specified row and column.
 
int put< T > (int row, int col, Span< T > data, int length)
 Writes a span of type T to the matrix at the specified row and column.
 
int put< T > (int row, int col, Span< T > data, int offset, int length)
 Writes a span of type T to the matrix at the specified row and column, starting from the specified offset within the data span.
 
int put< T > (int row, int col, T[] data)
 Writes an array of type T to the matrix at the specified row and column.
 
int put< T > (int row, int col, T[] data, int length)
 Writes an array of type T to the matrix at the specified row and column.
 
int put< T > (int row, int col, T[] data, int offset, int length)
 Writes an array of type T to the matrix at the specified row and column, starting from the specified offset within the data array.
 
int put< T > (int[] idx, Span< T > data)
 Writes a span of type T to the matrix at the specified indices.
 
int put< T > (int[] idx, Span< T > data, int length)
 Writes a span of type T to the matrix at the specified indices.
 
int put< T > (int[] idx, Span< T > data, int offset, int length)
 Writes a span of type T to the matrix at the specified indices, starting from the specified offset within the data span.
 
int put< T > (int[] idx, T[] data)
 Writes an array of type T to the matrix at the specified indices.
 
int put< T > (int[] idx, T[] data, int length)
 Writes an array of type T to the matrix at the specified indices.
 
int put< T > (int[] idx, T[] data, int offset, int length)
 Writes an array of type T to the matrix at the specified indices, starting from the specified offset within the data array.
 
void release ()
 Decrements the reference counter and deallocates the matrix if needed.
 
Mat reshape (int cn)
 Changes the shape and/or the number of channels of a 2D matrix without copying the data.
 
Mat reshape (int cn, int rows)
 Changes the shape and/or the number of channels of a 2D matrix without copying the data.
 
Mat reshape (int cn, int[] newshape)
 Changes the shape and/or the number of channels of a 2D matrix without copying the data.
 
Mat row (int y)
 Creates a matrix header for the specified matrix row.
 
Mat rowRange (in Vec2i r)
 Creates a matrix header for the specified row span.
 
Mat rowRange (in(int start, int end) r)
 Creates a matrix header for the specified row span.
 
Mat rowRange (int startrow, int endrow)
 Creates a matrix header for the specified row span.
 
Mat rowRange (Range r)
 Creates a matrix header for the specified row span.
 
int rows ()
 
Mat setTo (in Vec4d s)
 Sets all or some of the array elements to the specified value.
 
Mat setTo (in Vec4d value, Mat mask)
 Sets all or some of the array elements to the specified value.
 
Mat setTo (in(double v0, double v1, double v2, double v3) s)
 Sets all or some of the array elements to the specified value.
 
Mat setTo (in(double v0, double v1, double v2, double v3) value, Mat mask)
 Sets all or some of the array elements to the specified value.
 
Mat setTo (Mat value)
 Sets all or some of the array elements to the specified value.
 
Mat setTo (Mat value, Mat mask)
 Sets all or some of the array elements to the specified value.
 
Mat setTo (Scalar s)
 Sets all or some of the array elements to the specified value.
 
Mat setTo (Scalar value, Mat mask)
 Sets all or some of the array elements to the specified value.
 
Size size ()
 
int size (int i)
 
double double height sizeAsValueTuple ()
 
Vec2d sizeAsVec2d ()
 
long step1 ()
 Returns a normalized step.
 
long step1 (int i)
 Returns a normalized step.
 
Mat submat (in Vec2i rowRange, in Vec2i colRange)
 Extracts a rectangular submatrix.
 
Mat submat (in Vec2i[] ranges)
 Extracts a rectangular submatrix.
 
Mat submat (in Vec4i roi)
 Extracts a rectangular submatrix.
 
Mat submat (in(int start, int end) rowRange, in(int start, int end) colRange)
 Extracts a rectangular submatrix.
 
Mat submat (in(int start, int end)[] ranges)
 Extracts a rectangular submatrix.
 
Mat submat (in(int x, int y, int width, int height) roi)
 Extracts a rectangular submatrix.
 
Mat submat (int rowStart, int rowEnd, int colStart, int colEnd)
 Extracts a rectangular submatrix.
 
Mat submat (Range rowRange, Range colRange)
 Extracts a rectangular submatrix.
 
Mat submat (Range[] ranges)
 Extracts a rectangular submatrix.
 
Mat submat (Rect roi)
 Extracts a rectangular submatrix.
 
Mat t ()
 Transposes a matrix.
 
override string ToString ()
 
long total ()
 Returns the total number of array elements.
 
int type ()
 Returns the type of a matrix element.
 
int width ()
 Returns the number of columns in the matrix.
 
- Public Member Functions inherited from OpenCVForUnity.DisposableObject
void Dispose ()
 
void ThrowIfDisposed ()
 

Static Public Member Functions

static Mat diag (Mat d)
 creates a diagonal matrix
 
static Mat eye (in Vec2d size, int type)
 Returns an identity matrix of the specified size and type.
 
static Mat eye (in(double width, double height) size, int type)
 Returns an identity matrix of the specified size and type.
 
static Mat eye (int rows, int cols, int type)
 Returns an identity matrix of the specified size and type.
 
static Mat eye (Size size, int type)
 Returns an identity matrix of the specified size and type.
 
static Mat ones (in Vec2d size, int type)
 Returns an array of all 1's of the specified size and type.
 
static Mat ones (in(double width, double height) size, int type)
 Returns an array of all 1's of the specified size and type.
 
static Mat ones (int rows, int cols, int type)
 Returns an array of all 1's of the specified size and type.
 
static Mat ones (int[] sizes, int type)
 Returns an array of all 1's of the specified size and type.
 
static Mat ones (Size size, int type)
 Returns an array of all 1's of the specified size and type.
 
static Mat operator& (Mat a, Mat b)
 Performs a bitwise AND operation between two matrices.
 
static Mat operator& (Mat a, Scalar s)
 Performs a bitwise AND operation between a matrix and a scalar.
 
static Mat operator& (Scalar s, Mat a)
 Performs a bitwise AND operation between a scalar and a matrix.
 
static Mat operator* (double s, Mat a)
 Multiplies a matrix by a scalar value.
 
static Mat operator* (Mat a, double s)
 Multiplies a matrix by a scalar value.
 
static Mat operator* (Mat a, Mat b)
 Multiplies two matrices using the General Matrix Multiply (GEMM) operation.
 
static Mat operator+ (Mat a, Mat b)
 Adds two matrices element-wise.
 
static Mat operator+ (Mat a, Scalar s)
 Adds a scalar value to each element of the matrix.
 
static Mat operator+ (Scalar s, Mat a)
 Adds a scalar value to each element of the matrix.
 
static Mat operator- (Mat a)
 Negates all elements of the matrix.
 
static Mat operator- (Mat a, Mat b)
 Subtracts one matrix from another.
 
static Mat operator- (Mat a, Scalar s)
 Subtracts a scalar value from each element of the matrix.
 
static Mat operator- (Scalar s, Mat a)
 Subtracts a scalar value from each element of the matrix.
 
static Mat operator/ (double s, Mat a)
 Divides a scalar value by a matrix.
 
static Mat operator/ (Mat a, double s)
 Divides a matrix by a scalar value.
 
static Mat operator/ (Mat a, Mat b)
 Divides one matrix by another.
 
static Mat operator^ (Mat a, Mat b)
 Performs a bitwise XOR operation between two matrices.
 
static Mat operator^ (Mat a, Scalar s)
 Performs a bitwise XOR operation between a matrix and a scalar value.
 
static Mat operator^ (Scalar s, Mat a)
 Performs a bitwise XOR operation between a scalar value and a matrix.
 
static Mat operator| (Mat a, Mat b)
 Performs a bitwise OR operation between two matrices.
 
static Mat operator| (Mat a, Scalar s)
 Performs a bitwise OR operation between a matrix and a scalar value.
 
static Mat operator| (Scalar s, Mat a)
 Performs a bitwise OR operation between a scalar value and a matrix.
 
static Mat operator~ (Mat a)
 Performs a bitwise NOT operation on the matrix.
 
static Mat zeros (in Vec2d size, int type)
 Returns a zero array of the specified size and type.
 
static Mat zeros (in(double width, double height) size, int type)
 Returns a zero array of the specified size and type.
 
static Mat zeros (int rows, int cols, int type)
 Returns a zero array of the specified size and type.
 
static Mat zeros (int[] sizes, int type)
 Returns a zero array of the specified size and type.
 
static Mat zeros (Size size, int type)
 Returns a zero array of the specified size and type.
 
- Static Public Member Functions inherited from OpenCVForUnity.DisposableObject
static IntPtr ThrowIfNullIntPtr (IntPtr ptr)
 

Public Attributes

double width
 

Static Public Attributes

const int AUTO_STEP = 0
 

Protected Member Functions

override void Dispose (bool disposing)
 Deallocates the matrix data and releases resources.
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- Package Attributes inherited from OpenCVForUnity.DisposableOpenCVObject
- Properties inherited from OpenCVForUnity.DisposableObject
bool IsDisposed [get, protected set]
 
bool IsEnabledDispose [get, set]
 

Detailed Description

n-dimensional dense array class

C++: cv::Mat Class Reference

See also
https://docs.opencv.org/4.10.0/d3/d63/classcv_1_1Mat.html

Constructor & Destructor Documentation

◆ Mat() [1/32]

OpenCVForUnity.CoreModule.Mat.Mat ( IntPtr addr)

◆ Mat() [2/32]

OpenCVForUnity.CoreModule.Mat.Mat ( )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

◆ Mat() [3/32]

OpenCVForUnity.CoreModule.Mat.Mat ( int rows,
int cols,
int type )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
rowsNumber of rows in a 2D array.
colsNumber of columns in a 2D array.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.

◆ Mat() [4/32]

OpenCVForUnity.CoreModule.Mat.Mat ( Size size,
int type )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
size2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the number of columns go in the reverse order.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.

◆ Mat() [5/32]

OpenCVForUnity.CoreModule.Mat.Mat ( int[] sizes,
int type )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
sizesArray of integers specifying an n-dimensional array shape.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.

◆ Mat() [6/32]

OpenCVForUnity.CoreModule.Mat.Mat ( int rows,
int cols,
int type,
Scalar s )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
rowsNumber of rows in a 2D array.
colsNumber of columns in a 2D array.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.
sAn optional value to initialize each matrix element with. To set all the matrix elements to the particular value after the construction, use the assignment operator Mat::operator=(const Scalar& value) .

◆ Mat() [7/32]

OpenCVForUnity.CoreModule.Mat.Mat ( Size size,
int type,
Scalar s )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
size2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the number of columns go in the reverse order.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.
sAn optional value to initialize each matrix element with. To set all the matrix elements to the particular value after the construction, use the assignment operator Mat::operator=(const Scalar& value) .

◆ Mat() [8/32]

OpenCVForUnity.CoreModule.Mat.Mat ( int[] sizes,
int type,
Scalar s )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
sizesArray of integers specifying an n-dimensional array shape.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.
sAn optional value to initialize each matrix element with. To set all the matrix elements to the particular value after the construction, use the assignment operator Mat::operator=(const Scalar& value) .

◆ Mat() [9/32]

OpenCVForUnity.CoreModule.Mat.Mat ( Mat m,
Range rowRange,
Range colRange )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
mArray that (as a whole or partly) is assigned to the constructed matrix. No data is copied by these constructors.Instead, the header pointing to m data or its sub-array is constructed and associated with it.The reference counter, if any, is incremented.So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m.If you want to have an independent copy of the sub-array, use Mat.clone() .
rowRangeRange of the m rows to take. As usual, the range start is inclusive and the range end is exclusive.Use Range::all() to take all the rows.
colRangecolRange Range of the m columns to take. Use Range::all() to take all the columns.

◆ Mat() [10/32]

OpenCVForUnity.CoreModule.Mat.Mat ( Mat m,
Range rowRange )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
mArray that (as a whole or partly) is assigned to the constructed matrix. No data is copied by these constructors.Instead, the header pointing to m data or its sub-array is constructed and associated with it.The reference counter, if any, is incremented.So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m.If you want to have an independent copy of the sub-array, use Mat.clone() .
rowRangeRange of the m rows to take. As usual, the range start is inclusive and the range end is exclusive.Use Range::all() to take all the rows.

◆ Mat() [11/32]

OpenCVForUnity.CoreModule.Mat.Mat ( Mat m,
Range[] ranges )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
mArray that (as a whole or partly) is assigned to the constructed matrix. No data is copied by these constructors.Instead, the header pointing to m data or its sub-array is constructed and associated with it.The reference counter, if any, is incremented.So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m.If you want to have an independent copy of the sub-array, use Mat.clone() .
rangesArray of selected ranges of m along each dimensionality.

◆ Mat() [12/32]

OpenCVForUnity.CoreModule.Mat.Mat ( Mat m,
Rect roi )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
mArray that (as a whole or partly) is assigned to the constructed matrix. No data is copied by these constructors.Instead, the header pointing to m data or its sub-array is constructed and associated with it.The reference counter, if any, is incremented.So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m.If you want to have an independent copy of the sub-array, use Mat.clone() .
roiRegion of interest.

◆ Mat() [13/32]

OpenCVForUnity.CoreModule.Mat.Mat ( int rows,
int cols,
int type,
IntPtr data,
long step = AUTO_STEP )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
rowsNumber of rows in a 2D array.
colsNumber of columns in a 2D array.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.
dataPointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data.Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied.This operation is very efficient and can be used to process external data using OpenCV functions.The external data is not automatically deallocated, so you should take care of it.
stepNumber of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any.If the parameter is missing(set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols* elemSize(). See Mat.elemSize.

◆ Mat() [14/32]

OpenCVForUnity.CoreModule.Mat.Mat ( Size size,
int type,
IntPtr data,
long step = AUTO_STEP )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
size2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the number of columns go in the reverse order.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.
dataPointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data.Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied.This operation is very efficient and can be used to process external data using OpenCV functions.The external data is not automatically deallocated, so you should take care of it.
stepNumber of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any.If the parameter is missing(set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols* elemSize(). See Mat.elemSize.

◆ Mat() [15/32]

OpenCVForUnity.CoreModule.Mat.Mat ( in Vec2d size,
int type )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
size2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the number of columns go in the reverse order.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.

◆ Mat() [16/32]

OpenCVForUnity.CoreModule.Mat.Mat ( int rows,
int cols,
int type,
in Vec4d s )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
rowsNumber of rows in a 2D array.
colsNumber of columns in a 2D array.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.
sAn optional value to initialize each matrix element with. To set all the matrix elements to the particular value after the construction, use the assignment operator Mat::operator=(const Scalar& value) .

◆ Mat() [17/32]

OpenCVForUnity.CoreModule.Mat.Mat ( in Vec2d size,
int type,
in Vec4d s )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
size2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the number of columns go in the reverse order.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.
sAn optional value to initialize each matrix element with. To set all the matrix elements to the particular value after the construction, use the assignment operator Mat::operator=(const Scalar& value) .

◆ Mat() [18/32]

OpenCVForUnity.CoreModule.Mat.Mat ( int[] sizes,
int type,
in Vec4d s )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
sizesArray of integers specifying an n-dimensional array shape.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.
sAn optional value to initialize each matrix element with. To set all the matrix elements to the particular value after the construction, use the assignment operator Mat::operator=(const Scalar& value) .

◆ Mat() [19/32]

OpenCVForUnity.CoreModule.Mat.Mat ( Mat m,
in Vec2i rowRange,
in Vec2i colRange )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
mArray that (as a whole or partly) is assigned to the constructed matrix. No data is copied by these constructors.Instead, the header pointing to m data or its sub-array is constructed and associated with it.The reference counter, if any, is incremented.So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m.If you want to have an independent copy of the sub-array, use Mat.clone() .
rowRangeRange of the m rows to take. As usual, the range start is inclusive and the range end is exclusive.Use Range::all() to take all the rows.
colRangecolRange Range of the m columns to take. Use Range::all() to take all the columns.

◆ Mat() [20/32]

OpenCVForUnity.CoreModule.Mat.Mat ( Mat m,
in Vec2i rowRange )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
mArray that (as a whole or partly) is assigned to the constructed matrix. No data is copied by these constructors.Instead, the header pointing to m data or its sub-array is constructed and associated with it.The reference counter, if any, is incremented.So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m.If you want to have an independent copy of the sub-array, use Mat.clone() .
rowRangeRange of the m rows to take. As usual, the range start is inclusive and the range end is exclusive.Use Range::all() to take all the rows.

◆ Mat() [21/32]

OpenCVForUnity.CoreModule.Mat.Mat ( Mat m,
in Vec2i[] ranges )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
mArray that (as a whole or partly) is assigned to the constructed matrix. No data is copied by these constructors.Instead, the header pointing to m data or its sub-array is constructed and associated with it.The reference counter, if any, is incremented.So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m.If you want to have an independent copy of the sub-array, use Mat.clone() .
rangesArray of selected ranges of m along each dimensionality.

◆ Mat() [22/32]

OpenCVForUnity.CoreModule.Mat.Mat ( Mat m,
in Vec4i roi )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
mArray that (as a whole or partly) is assigned to the constructed matrix. No data is copied by these constructors.Instead, the header pointing to m data or its sub-array is constructed and associated with it.The reference counter, if any, is incremented.So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m.If you want to have an independent copy of the sub-array, use Mat.clone() .
roiRegion of interest.

◆ Mat() [23/32]

OpenCVForUnity.CoreModule.Mat.Mat ( in Vec2d size,
int type,
IntPtr data,
long step = AUTO_STEP )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
size2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the number of columns go in the reverse order.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.
dataPointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data.Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied.This operation is very efficient and can be used to process external data using OpenCV functions.The external data is not automatically deallocated, so you should take care of it.
stepNumber of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any.If the parameter is missing(set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols* elemSize(). See Mat.elemSize.

◆ Mat() [24/32]

OpenCVForUnity.CoreModule.Mat.Mat ( in(double width, double height) size,
int type )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
size2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the number of columns go in the reverse order.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.

◆ Mat() [25/32]

OpenCVForUnity.CoreModule.Mat.Mat ( int rows,
int cols,
int type,
in(double v0, double v1, double v2, double v3) s )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
rowsNumber of rows in a 2D array.
colsNumber of columns in a 2D array.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.
sAn optional value to initialize each matrix element with. To set all the matrix elements to the particular value after the construction, use the assignment operator Mat::operator=(const Scalar& value) .

◆ Mat() [26/32]

OpenCVForUnity.CoreModule.Mat.Mat ( in(double width, double height) size,
int type,
in(double v0, double v1, double v2, double v3) s )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
size2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the number of columns go in the reverse order.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.
sAn optional value to initialize each matrix element with. To set all the matrix elements to the particular value after the construction, use the assignment operator Mat::operator=(const Scalar& value) .

◆ Mat() [27/32]

OpenCVForUnity.CoreModule.Mat.Mat ( int[] sizes,
int type,
in(double v0, double v1, double v2, double v3) s )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
sizesArray of integers specifying an n-dimensional array shape.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.
sAn optional value to initialize each matrix element with. To set all the matrix elements to the particular value after the construction, use the assignment operator Mat::operator=(const Scalar& value) .

◆ Mat() [28/32]

OpenCVForUnity.CoreModule.Mat.Mat ( Mat m,
in(int start, int end) rowRange,
in(int start, int end) colRange )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
mArray that (as a whole or partly) is assigned to the constructed matrix. No data is copied by these constructors.Instead, the header pointing to m data or its sub-array is constructed and associated with it.The reference counter, if any, is incremented.So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m.If you want to have an independent copy of the sub-array, use Mat.clone() .
rowRangeRange of the m rows to take. As usual, the range start is inclusive and the range end is exclusive.Use Range::all() to take all the rows.
colRangecolRange Range of the m columns to take. Use Range::all() to take all the columns.

◆ Mat() [29/32]

OpenCVForUnity.CoreModule.Mat.Mat ( Mat m,
in(int start, int end) rowRange )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
mArray that (as a whole or partly) is assigned to the constructed matrix. No data is copied by these constructors.Instead, the header pointing to m data or its sub-array is constructed and associated with it.The reference counter, if any, is incremented.So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m.If you want to have an independent copy of the sub-array, use Mat.clone() .
rowRangeRange of the m rows to take. As usual, the range start is inclusive and the range end is exclusive.Use Range::all() to take all the rows.

◆ Mat() [30/32]

OpenCVForUnity.CoreModule.Mat.Mat ( Mat m,
in(int start, int end)[] ranges )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
mArray that (as a whole or partly) is assigned to the constructed matrix. No data is copied by these constructors.Instead, the header pointing to m data or its sub-array is constructed and associated with it.The reference counter, if any, is incremented.So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m.If you want to have an independent copy of the sub-array, use Mat.clone() .
rangesArray of selected ranges of m along each dimensionality.

◆ Mat() [31/32]

OpenCVForUnity.CoreModule.Mat.Mat ( Mat m,
in(int x, int y, int width, int height) roi )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
mArray that (as a whole or partly) is assigned to the constructed matrix. No data is copied by these constructors.Instead, the header pointing to m data or its sub-array is constructed and associated with it.The reference counter, if any, is incremented.So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m.If you want to have an independent copy of the sub-array, use Mat.clone() .
roiRegion of interest.

◆ Mat() [32/32]

OpenCVForUnity.CoreModule.Mat.Mat ( in(double width, double height) size,
int type,
IntPtr data,
long step = AUTO_STEP )

These are various constructors that form a matrix.As noted in the AutomaticAllocation, often the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The constructed matrix can further be assigned to another matrix or matrix expression or can be allocated with Mat::create.In the former case, the old content is de-referenced.

Parameters
size2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the number of columns go in the reverse order.
typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel(up to CV_CN_MAX channels) matrices.
dataPointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data.Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied.This operation is very efficient and can be used to process external data using OpenCV functions.The external data is not automatically deallocated, so you should take care of it.
stepNumber of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any.If the parameter is missing(set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols* elemSize(). See Mat.elemSize.

Member Function Documentation

◆ adjustROI()

Mat OpenCVForUnity.CoreModule.Mat.adjustROI ( int dtop,
int dbottom,
int dleft,
int dright )

Adjusts a submatrix size and position within the parent matrix.

The method is complimentary to Mat::locateROI.The typical use of these functions is to determine the submatrix position within the parent matrix and then shift the position somehow.Typically, it can be required for filtering operations when pixels outside of the ROI should be taken into account.When all the method parameters are positive, the ROI needs to grow in all directions by the specified amount, for example:

A.adjustROI(2, 2, 2, 2);

In this example, the matrix size is increased by 4 elements in each direction. The matrix is shifted by 2 elements to the left and 2 elements up, which brings in all the necessary pixels for the filtering with the 5x5 kernel.

adjustROI forces the adjusted ROI to be inside of the parent matrix that is boundaries of the adjusted ROI are constrained by boundaries of the parent matrix.For example, if the submatrix A is located in the first row of a parent matrix and you called A.adjustROI(2, 2, 2, 2) then A will not be increased in the upward direction.

The function is used internally by the OpenCV filtering functions, like filter2D , morphological operations, and so on.

Parameters
dtopShift of the top submatrix boundary upwards.
dbottomShift of the bottom submatrix boundary downwards.
dleftShift of the left submatrix boundary to the left.
drightShift of the right submatrix boundary to the right.
See also
copyMakeBorder

◆ assignTo() [1/2]

void OpenCVForUnity.CoreModule.Mat.assignTo ( Mat m)

Provides a functional form of convertTo.

This is an internally used method called by the MatrixExpressions engine.

Parameters
mDestination array.

◆ assignTo() [2/2]

void OpenCVForUnity.CoreModule.Mat.assignTo ( Mat m,
int type )

Provides a functional form of convertTo.

This is an internally used method called by the MatrixExpressions engine.

Parameters
mDestination array.
typeDesired destination array depth (or -1 if it should be the same as the source type).

◆ AsSpan< T >() [1/5]

Span< T > OpenCVForUnity.CoreModule.Mat.AsSpan< T > ( )

Creates and returns a Span<T> representing the entire data of the Mat object.

This method returns a pointer to the first element of the Mat object and uses it to create a Span<T> that spans the entire data stored in the Mat. The length of the Span<T> is calculated by dividing the total size of the Mat's data (in bytes) by the size of type T .

Type Mapping:

Mat CVType Description Data Type C# Type VecStruct
CV_8U Unsigned 8-bit integer unsigned char byte (System.Byte) VecNb
CV_8S Signed 8-bit integer signed char sbyte (System.SByte) VecNc
CV_16U Unsigned 16-bit integer unsigned short ushort (System.UInt16) VecNw
CV_16S Signed 16-bit integer short short (System.Int16) VecNs
CV_32S Signed 32-bit integer int int (System.Int32) VecNi
CV_32F 32-bit floating-point number float float (System.Single) VecNf
CV_64F 64-bit floating-point number double double (System.Double) VecNd

Note: This method only works with continuous Mat objects. If Mat.isContinuous() is false, an exception will be thrown. Ensure that the Mat is continuous before calling this method to avoid errors.

Template Parameters
TThe type of the elements in the Span<T>. Must be unmanaged to allow for direct memory access.
Returns
A Span<T> that represents the entire data of the Mat object.
Exceptions
CvExceptionThrown when Mat.isContinuous() is false, as this method requires a continuous Mat.
Type Constraints
T :unmanaged 

◆ AsSpan< T >() [2/5]

Span< T > OpenCVForUnity.CoreModule.Mat.AsSpan< T > ( int i0)

Creates and returns a Span<T> representing the data in the specified row or dimension of the Mat object.

This method returns a pointer to the first element in the specified row (i0) or dimension (i0) of the Mat object, depending on the number of dimensions in the Mat, and uses that pointer to create a Span<T>.

  • For 2D Mats, it returns a pointer to the first element in row i0 and spans the entire row.
  • For Mats with more than 2 dimensions, it returns a pointer to the first element in dimension i0, assuming the Mat is continuous. If Mat.isContinuous() is false, an exception is thrown.

The length of the Span<T> is determined by dividing the size of the data in the specified row or dimension by the size of type T .

Template Parameters
TThe type of the elements in the Span<T>. Must be unmanaged to allow for direct memory access.
Parameters
i0The index of the row or first dimension from which the pointer should be returned. Must be within the valid range for the Mat object.
Returns
A Span<T> representing the data in the specified row or dimension.
Exceptions
CvExceptionThrown when i0 is out of the valid range of rows or dimensions. Thrown when Mat.isContinuous() is false for Mats with more than 2 dimensions.
Type Constraints
T :unmanaged 

◆ AsSpan< T >() [3/5]

Span< T > OpenCVForUnity.CoreModule.Mat.AsSpan< T > ( int i0,
int i1 )

Creates and returns a Span<T> representing the data at the specified row and column, or dimensions, of the Mat object.

This method returns a pointer to the element in the specified row (i0) and column (i1) for 2D Mats, or the first two dimensions (i0, i1) for higher-dimensional Mats, and uses that pointer to create a Span<T>.

  • For 2D Mats, it returns a pointer to the specific element at row i0 and column i1, returning a Span<T> representing that single element.
  • For Mats with more than 2 dimensions, it returns a pointer to the element at indices i0 and i1, and spans the rest of the data in the remaining dimensions. If Mat.isContinuous() is false, an exception is thrown.

The length of the Span<T> is determined by dividing the size of the data in the Mat by the size of type T . For 2D Mats, it spans just one element.

Template Parameters
TThe type of the elements in the Span<T>. Must be unmanaged to allow for direct memory access.
Parameters
i0The row index or first dimension from which the pointer should be returned. Must be within the valid range for the Mat object.
i1The column index or second dimension from which the pointer should be returned. Must be within the valid range for the Mat object.
Returns
A Span<T> representing the data at the specified row and column, or dimensions.
Exceptions
CvExceptionThrown when i0 or i1 is out of the valid range of rows, columns, or dimensions. Thrown when Mat.isContinuous() is false for Mats with more than 2 dimensions.
Type Constraints
T :unmanaged 

◆ AsSpan< T >() [4/5]

Span< T > OpenCVForUnity.CoreModule.Mat.AsSpan< T > ( int i0,
int i1,
int i2 )

Creates and returns a Span<T> representing the data at the specified element in the Mat object, starting from the given three-dimensional indices.

This method returns a pointer to the element in the specified position (i0, i1, i2) of the Mat object and uses that pointer to create a Span<T>. The method works for Mats with 3 or more dimensions, spanning the data in the remaining dimensions if applicable.

  • For Mats with exactly 3 dimensions, it returns the pointer to the element at the indices (i0, i1, i2) and returns a Span<T> representing the element at that position.
  • For Mats with more than 3 dimensions, it returns the pointer at (i0, i1, i2) and spans the data across the remaining dimensions. If Mat.isContinuous() is false, an exception is thrown since continuous memory is required.

The length of the Span<T> is determined by dividing the size of the data by the size of type T . For 3D Mats, it spans one element, and for higher-dimensional Mats, it spans the remaining elements in the additional dimensions.

Template Parameters
TThe type of the elements in the Span<T>. Must be unmanaged to allow for direct memory access.
Parameters
i0The index for the first dimension (typically representing rows). Must be within the valid range of the Mat's first dimension.
i1The index for the second dimension (typically representing columns). Must be within the valid range of the Mat's second dimension.
i2The index for the third dimension. Must be within the valid range of the Mat's third dimension.
Returns
A Span<T> representing the data starting at the specified element in the Mat object.
Exceptions
CvExceptionThrown when i0 , i1 , or i2 are out of the valid range of the Mat's respective dimensions. Thrown when Mat.isContinuous() is false for Mats with more than 2 dimensions. Thrown when the Mat has fewer than 3 dimensions.
Type Constraints
T :unmanaged 

◆ AsSpan< T >() [5/5]

Span< T > OpenCVForUnity.CoreModule.Mat.AsSpan< T > ( params int[] idx)

Creates and returns a Span<T> representing the data at the specified element in the Mat object based on a variable number of indices.

This method returns a pointer to the element in the specified position, determined by the indices provided in the idx array, and uses that pointer to create a Span<T>. The method adapts to Mats with 2 or more dimensions:

  • For a 2D Mat, if one index is provided, it returns a Span<T> for the specified row. If two indices are provided, it returns a Span<T> for the specified element.
  • For higher-dimensional Mats, it returns the pointer at the specified indices and spans the remaining dimensions. If Mat.isContinuous() is false, an exception is thrown since continuous memory is required.

The length of the Span<T> is determined by dividing the size of the data by the size of type T . For multi-dimensional Mats, it spans one element or the remaining elements in the additional dimensions.

Template Parameters
TThe type of the elements in the Span<T>. Must be unmanaged to allow for direct memory access.
Parameters
idxAn array of indices specifying the position of the element in the Mat object. The number of indices must match the number of dimensions in the Mat.
Returns
A Span<T> representing the data starting at the specified element in the Mat object.
Exceptions
CvExceptionThrown when the number of dimensions in the Mat is less than the number of indices provided in idx . Thrown when any index in idx is out of bounds for the respective dimension. Thrown when Mat.isContinuous() is false for Mats with more than 2 dimensions.
Type Constraints
T :unmanaged 

◆ AsSpanRowRange< T >() [1/2]

Span< T > OpenCVForUnity.CoreModule.Mat.AsSpanRowRange< T > ( int startrow,
int endrow )

Creates and returns a Span<T> representing the data in the specified range of rows in the Mat object.

This method returns a pointer to the first element of the specified range of rows (from startrow to endrow ), and uses that pointer to create a Span<T> that spans the specified rows.

  • If the difference between startrow and endrow is 1, it returns a Span<T> for that single row.
  • For multi-row ranges, the method requires the Mat object to be continuous in memory, as checked by Mat.isContinuous().

The length of the Span<T> is determined by the number of rows and the size of the elements in the Mat object, divided by the size of type T .

Template Parameters
TThe type of the elements in the Span<T>. Must be unmanaged.
Parameters
startrowThe index of the first row in the range to be spanned. Must be within the valid range of rows.
endrowThe index of the row after the last row to be spanned. Must be greater than startrow and within the valid range of rows.
Returns
A Span<T> representing the data in the specified range of rows in the Mat object.
Exceptions
CvExceptionThrown when endrow is less than or equal to startrow , when either index is out of bounds, or when Mat.isContinuous() is false for multi-row ranges.
Type Constraints
T :unmanaged 

◆ AsSpanRowRange< T >() [2/2]

Span< T > OpenCVForUnity.CoreModule.Mat.AsSpanRowRange< T > ( Range r)

Creates and returns a Span<T> representing a range of rows from the Mat object, defined by the specified Range.

This method calls AsSpanRowRange<T>(int, int) internally, using the start and end indices from the provided Range. The resulting Span<T> includes the elements from the row specified by r.Start to the row before r.End.

Template Parameters
TThe type of the elements in the Span<T>. Must be unmanaged.
Parameters
rThe Range representing the start and end row indices.
Returns
A Span<T> representing the specified row range in the Mat object.
Type Constraints
T :unmanaged 

◆ at< T >() [1/4]

Span< T > OpenCVForUnity.CoreModule.Mat.at< T > ( int i0)

Creates and returns a Span<T> representing the first element in the specified row of the Mat object.

This method returns a pointer to the first element in the specified row (i0) of the Mat object, and uses that pointer to create a Span<T>. The length of the Span<T> is determined by dividing the size of one element of the Mat by the size of type T .

Note: This method does not perform bounds checking on the index i0. If i0 is out of bounds, an invalid pointer may be dereferenced, which can lead to undefined behavior. Ensure that the index is within the valid range for the Mat object.

Template Parameters
TThe type of the elements in the Span<T>. Must be unmanaged.
Parameters
i0The row index of the Mat from which the pointer should be returned. Must be within the valid range of rows.
Returns
A Span<T> representing the first element of the specified row.
Type Constraints
T :unmanaged 

◆ at< T >() [2/4]

Span< T > OpenCVForUnity.CoreModule.Mat.at< T > ( int i0,
int i1 )

Creates and returns a Span<T> representing the first element in the specified row and column of the Mat object.

This method returns a pointer to the first element in the specified row (i0) and column (i1) of the Mat object, and uses that pointer to create a Span<T>. The length of the Span<T> is determined by dividing the size of one element of the Mat by the size of type T .

Note: This method does not perform bounds checking on the indices i0 and i1. If any index is out of bounds, an invalid pointer may be dereferenced, which can lead to undefined behavior. Ensure that the indices are within the valid range for the Mat object.

Template Parameters
TThe type of the elements in the Span<T>. Must be unmanaged.
Parameters
i0The row index of the Mat from which the pointer should be returned. Must be within the valid range of rows.
i1The column index of the Mat from which the pointer should be returned. Must be within the valid range of columns.
Returns
A Span<T> representing the first element of the specified row and column.
Type Constraints
T :unmanaged 

◆ at< T >() [3/4]

Span< T > OpenCVForUnity.CoreModule.Mat.at< T > ( int i0,
int i1,
int i2 )

Creates and returns a Span<T> representing the first element in the specified row, column, and third dimension of the Mat object.

This method returns a pointer to the first element in the specified row (i0), column (i1), and third dimension (i2) of the Mat object, and uses that pointer to create a Span<T>. The length of the Span<T> is determined by dividing the size of one element of the Mat by the size of type T .

Note: This method does not perform bounds checking on the indices i0, i1, and i2. If any index is out of bounds, an invalid pointer may be dereferenced, which can lead to undefined behavior. Ensure that the indices are within the valid range for the Mat object.

Template Parameters
TThe type of the elements in the Span<T>. Must be unmanaged.
Parameters
i0The row index of the Mat from which the pointer should be returned. Must be within the valid range of rows.
i1The column index of the Mat from which the pointer should be returned. Must be within the valid range of columns.
i2The third dimension index of the Mat from which the pointer should be returned. Must be within the valid range of third dimension.
Returns
A Span<T> representing the first element of the specified row, column, and third dimension.
Type Constraints
T :unmanaged 

◆ at< T >() [4/4]

Span< T > OpenCVForUnity.CoreModule.Mat.at< T > ( params int[] idx)

Creates and returns a Span<T> representing the first element in the specified coordinates of the Mat object.

This method returns a pointer to the first element in the Mat object at the specified coordinates (idx), and uses that pointer to create a Span<T>. The length of the Span<T> is determined by dividing the size of one element of the Mat by the size of type T .

Note: This method does not perform bounds checking on the provided indices. If any index is out of bounds, an invalid pointer may be dereferenced, which can lead to undefined behavior. Ensure that the indices are within the valid range for the Mat object.

Template Parameters
TThe type of the elements in the Span<T>. Must be unmanaged.
Parameters
idxThe indices of the Mat from which the pointer should be returned. Must be within the valid range for each dimension of the Mat.
Returns
A Span<T> representing the first element at the specified coordinates in the Mat.
Type Constraints
T :unmanaged 

◆ channels()

int OpenCVForUnity.CoreModule.Mat.channels ( )

Returns the number of matrix channels.

returns the number of matrix channels.

◆ checkVector() [1/3]

int OpenCVForUnity.CoreModule.Mat.checkVector ( int elemChannels)
Parameters
elemChannelsNumber of channels or number of columns the matrix should have. For a 2-D matrix, when the matrix has only 1 column, then it should have elemChannels channels; When the matrix has only 1 channel, then it should have elemChannels columns. For a 3-D matrix, it should have only one channel. Furthermore, if the number of planes is not one, then the number of rows within every plane has to be 1; if the number of rows within every plane is not 1, then the number of planes has to be 1.
Returns
-1 if the requirement is not satisfied. Otherwise, it returns the number of elements in the matrix.Note that an element may have multiple channels.

The following code demonstrates its usage for a 2-d matrix:

cv::Mat mat(20, 1, CV_32FC2);
int n = mat.checkVector(2);
CV_Assert(n == 20); // mat has 20 elements
mat.create(20, 2, CV_32FC1);
n = mat.checkVector(1);
CV_Assert(n == -1); // mat is neither a column nor a row vector
n = mat.checkVector(2);
CV_Assert(n == 20); // the 2 columns are considered as 1 element

The following code demonstrates its usage for a 3-d matrix:

int dims[] = { 1, 3, 5 }; // 1 plane, every plane has 3 rows and 5 columns
mat.create(3, dims, CV_32FC1); // for 3-d mat, it MUST have only 1 channel
n = mat.checkVector(5); // the 5 columns are considered as 1 element
CV_Assert(n == 3);
int dims2[] = { 3, 1, 5 }; // 3 planes, every plane has 1 row and 5 columns
mat.create(3, dims2, CV_32FC1);
n = mat.checkVector(5); // the 5 columns are considered as 1 element
CV_Assert(n == 3);
int dims()
Definition Mat.cs:846

◆ checkVector() [2/3]

int OpenCVForUnity.CoreModule.Mat.checkVector ( int elemChannels,
int depth )
Parameters
elemChannelsNumber of channels or number of columns the matrix should have. For a 2-D matrix, when the matrix has only 1 column, then it should have elemChannels channels; When the matrix has only 1 channel, then it should have elemChannels columns. For a 3-D matrix, it should have only one channel. Furthermore, if the number of planes is not one, then the number of rows within every plane has to be 1; if the number of rows within every plane is not 1, then the number of planes has to be 1.
depthThe depth the matrix should have. Set it to -1 when any depth is fine.
Returns
-1 if the requirement is not satisfied. Otherwise, it returns the number of elements in the matrix.Note that an element may have multiple channels.

The following code demonstrates its usage for a 2-d matrix:

cv::Mat mat(20, 1, CV_32FC2);
int n = mat.checkVector(2);
CV_Assert(n == 20); // mat has 20 elements
mat.create(20, 2, CV_32FC1);
n = mat.checkVector(1);
CV_Assert(n == -1); // mat is neither a column nor a row vector
n = mat.checkVector(2);
CV_Assert(n == 20); // the 2 columns are considered as 1 element

The following code demonstrates its usage for a 3-d matrix:

int dims[] = { 1, 3, 5 }; // 1 plane, every plane has 3 rows and 5 columns
mat.create(3, dims, CV_32FC1); // for 3-d mat, it MUST have only 1 channel
n = mat.checkVector(5); // the 5 columns are considered as 1 element
CV_Assert(n == 3);
int dims2[] = { 3, 1, 5 }; // 3 planes, every plane has 1 row and 5 columns
mat.create(3, dims2, CV_32FC1);
n = mat.checkVector(5); // the 5 columns are considered as 1 element
CV_Assert(n == 3);

◆ checkVector() [3/3]

int OpenCVForUnity.CoreModule.Mat.checkVector ( int elemChannels,
int depth,
bool requireContinuous )
Parameters
elemChannelsNumber of channels or number of columns the matrix should have. For a 2-D matrix, when the matrix has only 1 column, then it should have elemChannels channels; When the matrix has only 1 channel, then it should have elemChannels columns. For a 3-D matrix, it should have only one channel. Furthermore, if the number of planes is not one, then the number of rows within every plane has to be 1; if the number of rows within every plane is not 1, then the number of planes has to be 1.
depthThe depth the matrix should have. Set it to -1 when any depth is fine.
requireContinuousSet it to true to require the matrix to be continuous
Returns
-1 if the requirement is not satisfied. Otherwise, it returns the number of elements in the matrix.Note that an element may have multiple channels.

The following code demonstrates its usage for a 2-d matrix:

cv::Mat mat(20, 1, CV_32FC2);
int n = mat.checkVector(2);
CV_Assert(n == 20); // mat has 20 elements
mat.create(20, 2, CV_32FC1);
n = mat.checkVector(1);
CV_Assert(n == -1); // mat is neither a column nor a row vector
n = mat.checkVector(2);
CV_Assert(n == 20); // the 2 columns are considered as 1 element

The following code demonstrates its usage for a 3-d matrix:

int dims[] = { 1, 3, 5 }; // 1 plane, every plane has 3 rows and 5 columns
mat.create(3, dims, CV_32FC1); // for 3-d mat, it MUST have only 1 channel
n = mat.checkVector(5); // the 5 columns are considered as 1 element
CV_Assert(n == 3);
int dims2[] = { 3, 1, 5 }; // 3 planes, every plane has 1 row and 5 columns
mat.create(3, dims2, CV_32FC1);
n = mat.checkVector(5); // the 5 columns are considered as 1 element
CV_Assert(n == 3);

◆ clone()

Mat OpenCVForUnity.CoreModule.Mat.clone ( )

Creates a full copy of the array and the underlying data.

The method creates a full copy of the array. The original step[] is not taken into account. So, the array copy is a continuous array occupying total()*elemSize() bytes.

◆ col()

Mat OpenCVForUnity.CoreModule.Mat.col ( int x)

Creates a matrix header for the specified matrix column.

The method makes a new header for the specified matrix column and returns it. This is an O(1) operation, regardless of the matrix size.The underlying data of the new matrix is shared with the original matrix.See also the Mat.row description.

Parameters
xA 0-based column index.

◆ colRange() [1/4]

Mat OpenCVForUnity.CoreModule.Mat.colRange ( in Vec2i r)

Creates a matrix header for the specified column span.

The method makes a new header for the specified column span of the matrix. Similarly to Mat.row and Mat.col , this is an O(1) operation.

Parameters
rRange structure containing both the start and the end indices.

◆ colRange() [2/4]

Mat OpenCVForUnity.CoreModule.Mat.colRange ( in(int start, int end) r)

Creates a matrix header for the specified column span.

The method makes a new header for the specified column span of the matrix. Similarly to Mat.row and Mat.col , this is an O(1) operation.

Parameters
rRange structure containing both the start and the end indices.

◆ colRange() [3/4]

Mat OpenCVForUnity.CoreModule.Mat.colRange ( int startcol,
int endcol )

Creates a matrix header for the specified column span.

The method makes a new header for the specified column span of the matrix. Similarly to Mat.row and Mat.col , this is an O(1) operation.

Parameters
startcolAn inclusive 0-based start index of the column span.
endcolAn exclusive 0-based ending index of the column span.

◆ colRange() [4/4]

Mat OpenCVForUnity.CoreModule.Mat.colRange ( Range r)

Creates a matrix header for the specified column span.

The method makes a new header for the specified column span of the matrix. Similarly to Mat.row and Mat.col , this is an O(1) operation.

Parameters
rRange structure containing both the start and the end indices.

◆ cols()

int OpenCVForUnity.CoreModule.Mat.cols ( )

number of columns in the matrix; -1 when the matrix has more than 2 dimensions

◆ convertTo() [1/3]

void OpenCVForUnity.CoreModule.Mat.convertTo ( Mat m,
int rtype )

Converts an array to another data type with optional scaling.

The method converts source pixel values to the target data type. saturate_cast<> is applied at the end to avoid possible overflows:

\[m(x,y) = saturate \_ cast<rType>( \alpha (*this)(x,y) + \beta )\]

Parameters
mOutput matrix; if it does not have a proper size or type before the operation, it is reallocated.
rtypeDesired output matrix type or, rather, the depth since the number of channels are the same as the input has; if rtype is negative, the output matrix will have the same type as the input.

◆ convertTo() [2/3]

void OpenCVForUnity.CoreModule.Mat.convertTo ( Mat m,
int rtype,
double alpha )

Converts an array to another data type with optional scaling.

The method converts source pixel values to the target data type. saturate_cast<> is applied at the end to avoid possible overflows:

\[m(x,y) = saturate \_ cast<rType>( \alpha (*this)(x,y) + \beta )\]

Parameters
mOutput matrix; if it does not have a proper size or type before the operation, it is reallocated.
rtypeDesired output matrix type or, rather, the depth since the number of channels are the same as the input has; if rtype is negative, the output matrix will have the same type as the input.
alphaOptional scale factor.

◆ convertTo() [3/3]

void OpenCVForUnity.CoreModule.Mat.convertTo ( Mat m,
int rtype,
double alpha,
double beta )

Converts an array to another data type with optional scaling.

The method converts source pixel values to the target data type. saturate_cast<> is applied at the end to avoid possible overflows:

\[m(x,y) = saturate \_ cast<rType>( \alpha (*this)(x,y) + \beta )\]

Parameters
mOutput matrix; if it does not have a proper size or type before the operation, it is reallocated.
rtypeDesired output matrix type or, rather, the depth since the number of channels are the same as the input has; if rtype is negative, the output matrix will have the same type as the input.
alphaOptional scale factor.
betaOptional delta added to the scaled values.

◆ copySize()

void OpenCVForUnity.CoreModule.Mat.copySize ( Mat m)

internal use function; properly re-allocates _size, _step arrays

◆ copyTo() [1/2]

void OpenCVForUnity.CoreModule.Mat.copyTo ( Mat m)

Copies the matrix to another one.

The method copies the matrix data to another matrix. Before copying the data, the method invokes :

m.create(this->size(), this->type());
int type()
Returns the type of a matrix element.
Definition Mat.cs:2605
Size size()
Definition Mat.cs:2354

so that the destination matrix is reallocated if needed. While m.copyTo(m); works flawlessly, the function does not handle the case of a partial overlap between the source and the destination matrices.

When the operation mask is specified, if the Mat.create call shown above reallocates the matrix, the newly allocated matrix is initialized with all zeros before copying the data.

Parameters
mDestination matrix. If it does not have a proper size or type before the operation, it is reallocated.

◆ copyTo() [2/2]

void OpenCVForUnity.CoreModule.Mat.copyTo ( Mat m,
Mat mask )

Copies the matrix to another one.

The method copies the matrix data to another matrix. Before copying the data, the method invokes :

m.create(this->size(), this->type());

so that the destination matrix is reallocated if needed. While m.copyTo(m); works flawlessly, the function does not handle the case of a partial overlap between the source and the destination matrices.

When the operation mask is specified, if the Mat.create call shown above reallocates the matrix, the newly allocated matrix is initialized with all zeros before copying the data.

Parameters
mDestination matrix. If it does not have a proper size or type before the operation, it is reallocated.
maskOperation mask of the same size as *this. Its non-zero elements indicate which matrix elements need to be copied.The mask has to be of type CV_8U and can have 1 or multiple channels.

◆ create() [1/5]

void OpenCVForUnity.CoreModule.Mat.create ( in Vec2d size,
int type )

Allocates new array data if needed.

This is one of the key Mat methods. Most new-style OpenCV functions and methods that produce arrays call this method for each output array. The method uses the following algorithm:

  1. If the current array shape and the type match the new ones, return immediately. Otherwise, de-reference the previous data by calling Mat.release.
  2. Initialize the new header.
  3. Allocate the new data of total()*elemSize() bytes.
  4. Allocate the new, associated with the data, reference counter and set it to 1.

Such a scheme makes the memory management robust and efficient at the same time and helps avoid extra typing for you. This means that usually there is no need to explicitly allocate output arrays. That is, instead of writing:

Mat color;
...
Mat gray(color.rows, color.cols, color.depth());
cvtColor(color, gray, COLOR_BGR2GRAY);
n-dimensional dense array class
Definition Mat_ValueTuple.cs:11
int depth()
Returns the depth of a matrix element.
Definition Mat.cs:1289
int rows()
Definition Mat.cs:2243
Mat(IntPtr addr)
Definition Mat.cs:64
int cols()
Definition Mat.cs:861

you can simply write:

Mat color;
...
Mat gray;
cvtColor(color, gray, COLOR_BGR2GRAY);

because cvtColor, as well as the most of OpenCV functions, calls Mat.create() for the output array internally.

Parameters
sizeAlternative new matrix size specification: Size(cols, rows)
typeNew matrix type.

◆ create() [2/5]

void OpenCVForUnity.CoreModule.Mat.create ( in(double width, double height) size,
int type )

Allocates new array data if needed.

This is one of the key Mat methods. Most new-style OpenCV functions and methods that produce arrays call this method for each output array. The method uses the following algorithm:

  1. If the current array shape and the type match the new ones, return immediately. Otherwise, de-reference the previous data by calling Mat.release.
  2. Initialize the new header.
  3. Allocate the new data of total()*elemSize() bytes.
  4. Allocate the new, associated with the data, reference counter and set it to 1.

Such a scheme makes the memory management robust and efficient at the same time and helps avoid extra typing for you. This means that usually there is no need to explicitly allocate output arrays. That is, instead of writing:

Mat color;
...
Mat gray(color.rows, color.cols, color.depth());
cvtColor(color, gray, COLOR_BGR2GRAY);

you can simply write:

Mat color;
...
Mat gray;
cvtColor(color, gray, COLOR_BGR2GRAY);

because cvtColor, as well as the most of OpenCV functions, calls Mat.create() for the output array internally.

Parameters
sizeAlternative new matrix size specification: Size(cols, rows)
typeNew matrix type.

◆ create() [3/5]

void OpenCVForUnity.CoreModule.Mat.create ( int rows,
int cols,
int type )

Allocates new array data if needed.

This is one of the key Mat methods. Most new-style OpenCV functions and methods that produce arrays call this method for each output array. The method uses the following algorithm:

  1. If the current array shape and the type match the new ones, return immediately. Otherwise, de-reference the previous data by calling Mat.release.
  2. Initialize the new header.
  3. Allocate the new data of total()*elemSize() bytes.
  4. Allocate the new, associated with the data, reference counter and set it to 1.

Such a scheme makes the memory management robust and efficient at the same time and helps avoid extra typing for you. This means that usually there is no need to explicitly allocate output arrays. That is, instead of writing:

Mat color;
...
Mat gray(color.rows, color.cols, color.depth());
cvtColor(color, gray, COLOR_BGR2GRAY);

you can simply write:

Mat color;
...
Mat gray;
cvtColor(color, gray, COLOR_BGR2GRAY);

because cvtColor, as well as the most of OpenCV functions, calls Mat.create() for the output array internally.

Parameters
rowsNew number of rows.
colsNew number of columns.
typeNew matrix type.

◆ create() [4/5]

void OpenCVForUnity.CoreModule.Mat.create ( int[] sizes,
int type )

Allocates new array data if needed.

This is one of the key Mat methods. Most new-style OpenCV functions and methods that produce arrays call this method for each output array. The method uses the following algorithm:

  1. If the current array shape and the type match the new ones, return immediately. Otherwise, de-reference the previous data by calling Mat.release.
  2. Initialize the new header.
  3. Allocate the new data of total()*elemSize() bytes.
  4. Allocate the new, associated with the data, reference counter and set it to 1.

Such a scheme makes the memory management robust and efficient at the same time and helps avoid extra typing for you. This means that usually there is no need to explicitly allocate output arrays. That is, instead of writing:

Mat color;
...
Mat gray(color.rows, color.cols, color.depth());
cvtColor(color, gray, COLOR_BGR2GRAY);

you can simply write:

Mat color;
...
Mat gray;
cvtColor(color, gray, COLOR_BGR2GRAY);

because cvtColor, as well as the most of OpenCV functions, calls Mat.create() for the output array internally.

Parameters
sizesArray of integers specifying a new array shape.
typeNew matrix type.

◆ create() [5/5]

void OpenCVForUnity.CoreModule.Mat.create ( Size size,
int type )

Allocates new array data if needed.

This is one of the key Mat methods. Most new-style OpenCV functions and methods that produce arrays call this method for each output array. The method uses the following algorithm:

  1. If the current array shape and the type match the new ones, return immediately. Otherwise, de-reference the previous data by calling Mat.release.
  2. Initialize the new header.
  3. Allocate the new data of total()*elemSize() bytes.
  4. Allocate the new, associated with the data, reference counter and set it to 1.

Such a scheme makes the memory management robust and efficient at the same time and helps avoid extra typing for you. This means that usually there is no need to explicitly allocate output arrays. That is, instead of writing:

Mat color;
...
Mat gray(color.rows, color.cols, color.depth());
cvtColor(color, gray, COLOR_BGR2GRAY);

you can simply write:

Mat color;
...
Mat gray;
cvtColor(color, gray, COLOR_BGR2GRAY);

because cvtColor, as well as the most of OpenCV functions, calls Mat.create() for the output array internally.

Parameters
sizeAlternative new matrix size specification: Size(cols, rows)
typeNew matrix type.

◆ cross()

Mat OpenCVForUnity.CoreModule.Mat.cross ( Mat m)

Computes a cross-product of two 3-element vectors.

The method computes a cross-product of two 3-element vectors. The vectors must be 3-element floating-point vectors of the same shape and size. The result is another 3-element vector of the same shape and type as operands.

Parameters
mAnother cross-product operand.

◆ dataAddr()

long OpenCVForUnity.CoreModule.Mat.dataAddr ( )

Returns the first pointer address of Mat data.

Returns
Returns the first pointer address of Mat data.

◆ depth()

int OpenCVForUnity.CoreModule.Mat.depth ( )

Returns the depth of a matrix element.

The method returns the identifier of the matrix element depth (the type of each individual channel). For example, for a 16-bit signed element array, the method returns CV_16S. A complete list of matrix types contains the following values:

  • CV_8U - 8-bit unsigned integers ( 0..255 )
  • CV_8S - 8-bit signed integers ( -128..127 )
  • CV_16U - 16-bit unsigned integers ( 0..65535 )
  • CV_16S - 16-bit signed integers ( -32768..32767 )
  • CV_32S - 32-bit signed integers ( -2147483648..2147483647 )
  • CV_32F - 32-bit floating-point numbers ( -FLT_MAX..FLT_MAX, INF, NAN )
  • CV_64F - 64-bit floating-point numbers ( -DBL_MAX..DBL_MAX, INF, NAN )

◆ diag() [1/3]

Mat OpenCVForUnity.CoreModule.Mat.diag ( )

Extracts a diagonal from a matrix.

The method makes a new header for the specified matrix diagonal. The new matrix is represented as a single-column matrix. Similarly to Mat.row and Mat.col, this is an O(1) operation.

For example:

Mat m = (Mat_<int>(3,3) <<
1,2,3,
4,5,6,
7,8,9);
Mat d0 = m.diag(0);
Mat d1 = m.diag(1);
Mat d_1 = m.diag(-1);
Mat diag(int d)
Extracts a diagonal from a matrix.
Definition Mat.cs:1346

The resulting matrices are:

d0 =
[1;
5;
9]
d1 =
[2;
6]
d_1 =
[4;
8]

◆ diag() [2/3]

Mat OpenCVForUnity.CoreModule.Mat.diag ( int d)

Extracts a diagonal from a matrix.

The method makes a new header for the specified matrix diagonal. The new matrix is represented as a single-column matrix. Similarly to Mat.row and Mat.col, this is an O(1) operation.

Parameters
dIndex of the diagonal, with the following values:
  • d=0 is the main diagonal.
  • d<0 is a diagonal from the lower half. For example, d=-1 means the diagonal is set immediately below the main one.
  • d>0 is a diagonal from the upper half. For example, d=1 means the diagonal is set immediately above the main one.

For example:

Mat m = (Mat_<int>(3,3) <<
1,2,3,
4,5,6,
7,8,9);
Mat d0 = m.diag(0);
Mat d1 = m.diag(1);
Mat d_1 = m.diag(-1);

The resulting matrices are:

d0 =
[1;
5;
9]
d1 =
[2;
6]
d_1 =
[4;
8]

◆ diag() [3/3]

static Mat OpenCVForUnity.CoreModule.Mat.diag ( Mat d)
static

creates a diagonal matrix

The method creates a square diagonal matrix from specified main diagonal.

Parameters
dOne-dimensional matrix that represents the main diagonal.

◆ dims()

int OpenCVForUnity.CoreModule.Mat.dims ( )

returns the matrix dimensionality

◆ Dispose()

override void OpenCVForUnity.CoreModule.Mat.Dispose ( bool disposing)
protectedvirtual

Deallocates the matrix data and releases resources.

This method decrements the reference counter associated with the matrix data. If the reference counter reaches zero, the matrix data is deallocated, and the data and reference counter pointers are set to null. It is generally not necessary to call this method manually, as it is automatically invoked in the destructor or by any other method that changes the data pointer. The reference counter decrement and check for zero is an atomic operation on supported platforms, ensuring thread safety when operating on the same matrices asynchronously.

Reimplemented from OpenCVForUnity.DisposableOpenCVObject.

◆ dot()

double OpenCVForUnity.CoreModule.Mat.dot ( Mat m)

Computes a dot-product of two vectors.

The method computes a dot-product of two matrices. If the matrices are not single-column or single-row vectors, the top-to-bottom left-to-right scan ordering is used to treat them as 1D vectors. The vectors must have the same size and type. If the matrices have more than one channel, the dot products from all the channels are summed together.

Parameters
mAnother dot-product operand.

◆ dump()

string OpenCVForUnity.CoreModule.Mat.dump ( )

Returns the contents of the visualized matrix in String format.

This method returns the matrix elements in String format, formatted in a human-readable format. This is useful for debugging to quickly visualize the matrix contents. Only works with two-dimensional Mat.

Returns
Returns the contents of the visualized matrix in String format.

◆ elemSize()

long OpenCVForUnity.CoreModule.Mat.elemSize ( )

Returns the matrix element size in bytes.

The method returns the matrix element size in bytes. For example, if the matrix type is CV_16SC3, the method returns 3 * sizeof(short) or 6.

◆ elemSize1()

long OpenCVForUnity.CoreModule.Mat.elemSize1 ( )

Returns the size of each matrix element channel in bytes.

The method returns the matrix element channel size in bytes, that is, it ignores the number of channels. For example, if the matrix type is CV_16SC3, the method returns sizeof(short) or 2.

◆ empty()

bool OpenCVForUnity.CoreModule.Mat.empty ( )

Returns true if the array has no elements.

The method returns true if Mat.total() == 0 or if Mat::data == null. Because of pop_back() and resize() methods, M.total() == 0 does not imply that M.data == null.

◆ eye() [1/4]

static Mat OpenCVForUnity.CoreModule.Mat.eye ( in Vec2d size,
int type )
static

Returns an identity matrix of the specified size and type.

The method returns a Matlab-style identity matrix initializer, similarly to Mat.zeros. Similarly to Mat.ones, you can use a scale operation to create a scaled identity matrix efficiently:

// make a 4x4 diagonal matrix with 0.1's on the diagonal.
Mat A = Mat::eye(4, 4, CV_32F)*0.1;
static Mat eye(int rows, int cols, int type)
Returns an identity matrix of the specified size and type.
Definition Mat.cs:1526
Note
In case of multi-channels type, identity matrix will be initialized only for the first channel, the others will be set to 0's
Parameters
sizeAlternative matrix size specification as Size(cols, rows) .
typeCreated matrix type.

◆ eye() [2/4]

static Mat OpenCVForUnity.CoreModule.Mat.eye ( in(double width, double height) size,
int type )
static

Returns an identity matrix of the specified size and type.

The method returns a Matlab-style identity matrix initializer, similarly to Mat.zeros. Similarly to Mat.ones, you can use a scale operation to create a scaled identity matrix efficiently:

// make a 4x4 diagonal matrix with 0.1's on the diagonal.
Mat A = Mat::eye(4, 4, CV_32F)*0.1;
Note
In case of multi-channels type, identity matrix will be initialized only for the first channel, the others will be set to 0's
Parameters
sizeAlternative matrix size specification as Size(cols, rows) .
typeCreated matrix type.

◆ eye() [3/4]

static Mat OpenCVForUnity.CoreModule.Mat.eye ( int rows,
int cols,
int type )
static

Returns an identity matrix of the specified size and type.

The method returns a Matlab-style identity matrix initializer, similarly to Mat.zeros. Similarly to Mat.ones, you can use a scale operation to create a scaled identity matrix efficiently:

// make a 4x4 diagonal matrix with 0.1's on the diagonal.
Mat A = Mat::eye(4, 4, CV_32F)*0.1;
Note
In case of multi-channels type, identity matrix will be initialized only for the first channel, the others will be set to 0's
Parameters
rowsNumber of rows.
colsNumber of columns.
typeCreated matrix type.

◆ eye() [4/4]

static Mat OpenCVForUnity.CoreModule.Mat.eye ( Size size,
int type )
static

Returns an identity matrix of the specified size and type.

The method returns a Matlab-style identity matrix initializer, similarly to Mat.zeros. Similarly to Mat.ones, you can use a scale operation to create a scaled identity matrix efficiently:

// make a 4x4 diagonal matrix with 0.1's on the diagonal.
Mat A = Mat::eye(4, 4, CV_32F)*0.1;
Note
In case of multi-channels type, identity matrix will be initialized only for the first channel, the others will be set to 0's
Parameters
sizeAlternative matrix size specification as Size(cols, rows) .
typeCreated matrix type.

◆ get() [1/86]

double[] OpenCVForUnity.CoreModule.Mat.get ( int row,
int col )

Reads the element values from the matrix at the specified row and column, returning them as an array of double values.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
Returns
An array of double values representing the matrix element(s) at the specified row and column. The length of the array corresponds to the number of channels in the matrix at the specified location. If the read operation fails, returns null.

This method reads the element values at the specified row and column in the matrix and returns them as double values. Regardless of the matrix's actual data type, the values are cast to double. The size of the returned array depends on the number of channels in the matrix.

Exceptions
CvExceptionThrown if the matrix is disposed or if an error occurs while retrieving the data.

◆ get() [2/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
byte[] data )

Reads a byte array from the matrix at the specified row and column.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe byte array where the read data elements will be stored.
Returns
The number of elements successfully read from the matrix.

This method reads the specified byte array from the matrix at the given row and column. The length of the data array must be sufficient to hold the data, and it must be a multiple of the matrix's channel count. Only matrices with a data type of CV_8U or CV_8S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the length of the data array is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_8U or CV_8S.

◆ get() [3/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
byte[] data,
int length )

Reads a specified number of byte values from the matrix at the given row and column.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe byte array where the read data elements will be stored.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of byte values from the matrix at the given row and column. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_8U or CV_8S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_8U or CV_8S.

◆ get() [4/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
byte[] data,
int offset,
int length )

Reads a specified number of byte values from the matrix at the given row and column, storing them in the data array starting at the specified offset.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe byte array where the read data elements will be stored.
offsetThe starting point within the array from which the data will be placed.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of byte values from the matrix at the given row and column, storing them in the data array starting at the specified offset. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_8U or CV_8S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_8U or CV_8S.

◆ get() [5/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
double[] data )

Reads a double array from the matrix at the specified row and column.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe double array where the read data elements will be stored.
Returns
The number of elements successfully read from the matrix.

This method reads the specified double array from the matrix at the given row and column. The length of the data array must be sufficient to hold the data, and it must be a multiple of the matrix's channel count. Only matrices with a data type of CV_64F are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the length of the data array is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_64F.

◆ get() [6/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
double[] data,
int length )

Reads a specified number of double values from the matrix at the given row and column.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe double array where the read data elements will be stored.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of double values from the matrix at the given row and column. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_64F are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_64F.

◆ get() [7/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
double[] data,
int offset,
int length )

Reads a specified number of double values from the matrix at the given row and column, storing them in the data array starting at the specified offset.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe double array where the read data elements will be stored.
offsetThe starting point within the array from which the data will be placed.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of double values from the matrix at the given row and column, storing them in the data array starting at the specified offset. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_64F are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_64F.

◆ get() [8/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
float[] data )

Reads a float array from the matrix at the specified row and column.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe float array where the read data elements will be stored.
Returns
The number of elements successfully read from the matrix.

This method reads the specified float array from the matrix at the given row and column. The length of the data array must be sufficient to hold the data, and it must be a multiple of the matrix's channel count. Only matrices with a data type of CV_32F are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the length of the data array is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_32F.

◆ get() [9/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
float[] data,
int length )

Reads a specified number of float values from the matrix at the given row and column.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe float array where the read data elements will be stored.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of float values from the matrix at the given row and column. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_32F are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_32F.

◆ get() [10/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
float[] data,
int offset,
int length )

Reads a specified number of float values from the matrix at the given row and column, storing them in the data array starting at the specified offset.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe float array where the read data elements will be stored.
offsetThe starting point within the array from which the data will be placed.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of float values from the matrix at the given row and column, storing them in the data array starting at the specified offset. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_32F are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_32F.

◆ get() [11/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
int[] data )

Reads an int array from the matrix at the specified row and column.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe int array where the read data elements will be stored.
Returns
The number of elements successfully read from the matrix.

This method reads the specified int array from the matrix at the given row and column. The length of the data array must be sufficient to hold the data, and it must be a multiple of the matrix's channel count. Only matrices with a data type of CV_32S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the length of the data array is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_32S.

◆ get() [12/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
int[] data,
int length )

Reads a specified number of int values from the matrix at the given row and column.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe int array where the read data elements will be stored.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of int values from the matrix at the given row and column. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_32S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_32S. </exception

◆ get() [13/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
int[] data,
int offset,
int length )

Reads a specified number of int values from the matrix at the given row and column, storing them in the data array starting at the specified offset.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe int array where the read data elements will be stored.
offsetThe starting point within the array from which the data will be placed.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of int values from the matrix at the given row and column, storing them in the data array starting at the specified offset. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_32S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_32S.

◆ get() [14/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
sbyte[] data )

Reads a sbyte array from the matrix at the specified row and column.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe sbyte array where the read data elements will be stored.
Returns
The number of elements successfully read from the matrix.

This method reads the specified sbyte array from the matrix at the given row and column. The length of the data array must be sufficient to hold the data, and it must be a multiple of the matrix's channel count. Only matrices with a data type of CV_8U or CV_8S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the length of the data array is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_8U or CV_8S.

◆ get() [15/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
sbyte[] data,
int length )

Reads a specified number of sbyte values from the matrix at the given row and column.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe sbyte array where the read data elements will be stored.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of sbyte values from the matrix at the given row and column. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_8U or CV_8S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_8U or CV_8S.

◆ get() [16/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
sbyte[] data,
int offset,
int length )

Reads a specified number of sbyte values from the matrix at the given row and column, storing them in the data array starting at the specified offset.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe sbyte array where the read data elements will be stored.
offsetThe starting point within the array from which the data will be placed.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of sbyte values from the matrix at the given row and column, storing them in the data array starting at the specified offset. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_8U or CV_8S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_8U or CV_8S.

◆ get() [17/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
short[] data )

Reads a short array from the matrix at the specified row and column.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe short array where the read data elements will be stored.
Returns
The number of elements successfully read from the matrix.

This method reads the specified short array from the matrix at the given row and column. The length of the data array must be sufficient to hold the data, and it must be a multiple of the matrix's channel count. Only matrices with a data type of CV_16U or CV_16S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the length of the data array is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_16U or CV_16S.

◆ get() [18/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
short[] data,
int length )

Reads a specified number of short values from the matrix at the given row and column.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe short array where the read data elements will be stored.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of short values from the matrix at the given row and column. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_16U or CV_16S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_16U or CV_16S.

◆ get() [19/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
short[] data,
int offset,
int length )

Reads a specified number of short values from the matrix at the given row and column, storing them in the data array starting at the specified offset.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe short array where the read data elements will be stored.
offsetThe starting point within the array from which the data will be placed.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of short values from the matrix at the given row and column, storing them in the data array starting at the specified offset. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_16U or CV_16S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_16U or CV_16S.

◆ get() [20/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< byte > data )

Reads a span of byte data from the matrix at the specified row and column.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of byte data to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of byte data from the matrix at the given row and column. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [21/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< byte > data,
int length )

Reads a span of byte data from the matrix at the specified row and column.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of byte data to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of byte data from the matrix at the given row and column. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [22/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< byte > data,
int offset,
int length )

Reads a span of byte data from the matrix at the specified row and column, storing them in the data span starting at the specified offset.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of byte data to store the read values.
offsetThe offset within the span at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of byte data from the matrix at the given row and column, storing them in the data span starting at the specified offset. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [23/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< double > data )

Reads a span of double data from the matrix at the specified row and column.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of double data to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of double data from the matrix at the given row and column. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [24/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< double > data,
int length )

Reads a span of double data from the matrix at the specified row and column.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of double data to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of double data from the matrix at the given row and column. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [25/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< double > data,
int offset,
int length )

Reads a span of double data from the matrix at the specified row and column, storing them in the data span starting at the specified offset.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of double data to store the read values.
offsetThe offset within the span at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of double data from the matrix at the given row and column, storing them in the data span starting at the specified offset. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [26/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< float > data )

Reads a span of float data from the matrix at the specified row and column.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of float data to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of float data from the matrix at the given row and column. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [27/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< float > data,
int length )

Reads a span of float data from the matrix at the specified row and column.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of float data to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of float data from the matrix at the given row and column. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [28/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< float > data,
int offset,
int length )

Reads a span of float data from the matrix at the specified row and column, storing them in the data span starting at the specified offset.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of float data to store the read values.
offsetThe offset within the span at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of float data from the matrix at the given row and column, storing them in the data span starting at the specified offset. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [29/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< int > data )

Reads a span of int data from the matrix at the specified row and column.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of int data to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of int data from the matrix at the given row and column. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [30/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< int > data,
int length )

Reads a span of int data from the matrix at the specified row and column.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of int data to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of int data from the matrix at the given row and column. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [31/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< int > data,
int offset,
int length )

Reads a span of int data from the matrix at the specified row and column, storing them in the data span starting at the specified offset.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of int data to store the read values.
offsetThe offset within the span at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of int data from the matrix at the given row and column, storing them in the data span starting at the specified offset. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [32/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< sbyte > data )

Reads a span of sbyte data from the matrix at the specified row and column.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of sbyte data to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of sbyte data from the matrix at the given row and column. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [33/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< sbyte > data,
int length )

Reads a span of sbyte data from the matrix at the specified row and column.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of sbyte data to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of sbyte data from the matrix at the given row and column. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [34/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< sbyte > data,
int offset,
int length )

Reads a span of sbyte data from the matrix at the specified row and column, storing them in the data span starting at the specified offset.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of sbyte data to store the read values.
offsetThe offset within the span at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of sbyte data from the matrix at the given row and column, storing them in the data span starting at the specified offset. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [35/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< short > data )

Reads a span of short data from the matrix at the specified row and column.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of short data to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of short data from the matrix at the given row and column. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [36/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< short > data,
int length )

Reads a span of short data from the matrix at the specified row and column.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of short data to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of short data from the matrix at the given row and column. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [37/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< short > data,
int offset,
int length )

Reads a span of short data from the matrix at the specified row and column, storing them in the data span starting at the specified offset.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of short data to store the read values.
offsetThe offset within the span at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of short data from the matrix at the given row and column, storing them in the data span starting at the specified offset. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [38/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< ushort > data )

Reads a span of ushort data from the matrix at the specified row and column.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of ushort data to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of ushort data from the matrix at the given row and column. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [39/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< ushort > data,
int length )

Reads a span of ushort data from the matrix at the specified row and column.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of ushort data to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of ushort data from the matrix at the given row and column. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [40/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
Span< ushort > data,
int offset,
int length )

Reads a span of ushort data from the matrix at the specified row and column, storing them in the data span starting at the specified offset.

Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of ushort data to store the read values.
offsetThe offset within the span at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of ushort data from the matrix at the given row and column, storing them in the data span starting at the specified offset. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [41/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
ushort[] data )

Reads an ushort array from the matrix at the specified row and column.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe ushort array where the read data elements will be stored.
Returns
The number of elements successfully read from the matrix.

This method reads the specified ushort array from the matrix at the given row and column. The length of the data array must be sufficient to hold the data, and it must be a multiple of the matrix's channel count. Only matrices with a data type of CV_16U or CV_16S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the length of the data array is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_16U or CV_16S.

◆ get() [42/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
ushort[] data,
int length )

Reads a specified number of ushort values from the matrix at the given row and column.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe ushort array where the read data elements will be stored.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of ushort values from the matrix at the given row and column. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_16U or CV_16S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_16U or CV_16S.

◆ get() [43/86]

int OpenCVForUnity.CoreModule.Mat.get ( int row,
int col,
ushort[] data,
int offset,
int length )

Reads a specified number of ushort values from the matrix at the given row and column, storing them in the data array starting at the specified offset.

Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
dataThe ushort array where the read data elements will be stored.
offsetThe starting point within the array from which the data will be placed.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of ushort values from the matrix at the given row and column, storing them in the data array starting at the specified offset. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_16U or CV_16S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_16U or CV_16S.

◆ get() [44/86]

double[] OpenCVForUnity.CoreModule.Mat.get ( int[] idx)

Reads the element values from the matrix at the specified indices, returning them as an array of double values.

Parameters
idxAn array of indices specifying the location from which the data will be read.
Returns
An array of double values representing the matrix element(s) at the specified indices. The length of the array corresponds to the number of channels in the matrix at the specified location. If the read operation fails, returns null.

This method reads the element values at the specified indices in the matrix and returns them as double values. Regardless of the matrix's actual data type, the values are cast to double. The size of the returned array depends on the number of channels in the matrix.

Exceptions
CvExceptionThrown if the matrix is disposed or if an error occurs while retrieving the data, if the number of indices is incorrect.

◆ get() [45/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
byte[] data )

Reads a byte array from the matrix at the specified indices.

Parameters
idxAn array of indices specifying the location from which the data will be read.
dataThe byte array where the read data elements will be stored.
Returns
The number of elements successfully read from the matrix.

This method reads the specified byte array from the matrix at the given indices. The length of the data array must be sufficient to hold the data, and it must be a multiple of the matrix's channel count. The number of indices in idx must match the matrix's dimension count. Only matrices with a data type of CV_8U or CV_8S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the length of the data array is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_8U or CV_8S.

◆ get() [46/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
byte[] data,
int length )

Reads a specified number of byte values from the matrix at the given indices.

Parameters
idxThe array of indices corresponding to the dimensions of the matrix.
dataThe byte array where the read data elements will be stored.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of byte values from the matrix at the given indices. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_8U or CV_8S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_8U or CV_8S.

◆ get() [47/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
byte[] data,
int offset,
int length )

Reads a specified number of byte values from the matrix at the given indices, storing them in the data array starting at the specified offset.

Parameters
idxThe array of indices corresponding to the dimensions of the matrix.
dataThe byte array where the read data elements will be stored.
offsetThe starting point within the array from which the data will be placed.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of byte values from the matrix at the given indices, storing them in the data array starting at the specified offset. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_8U or CV_8S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_8U or CV_8S.

◆ get() [48/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
double[] data )

Reads a double array from the matrix at the specified indices.

Parameters
idxAn array of indices specifying the location from which the data will be read.
dataThe double array where the read data elements will be stored.
Returns
The number of elements successfully read from the matrix.

This method reads the specified double array from the matrix at the given indices. The length of the data array must be sufficient to hold the data, and it must be a multiple of the matrix's channel count. The number of indices in idx must match the matrix's dimension count. Only matrices with a data type of CV_64F are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the length of the data array is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_64F.

◆ get() [49/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
double[] data,
int length )

Reads a specified number of double values from the matrix at the given indices.

Parameters
idxThe array of indices corresponding to the dimensions of the matrix.
dataThe double array where the read data elements will be stored.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of double values from the matrix at the given indices. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_64F are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_64F.

◆ get() [50/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
double[] data,
int offset,
int length )

Reads a specified number of double values from the matrix at the given indices, storing them in the data array starting at the specified offset.

Parameters
idxThe array of indices corresponding to the dimensions of the matrix.
dataThe double array where the read data elements will be stored.
offsetThe starting point within the array from which the data will be placed.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of double values from the matrix at the given indices, storing them in the data array starting at the specified offset. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_64F are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_64F.

◆ get() [51/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
float[] data )

Reads a float array from the matrix at the specified indices.

Parameters
idxAn array of indices specifying the location from which the data will be read.
dataThe float array where the read data elements will be stored.
Returns
The number of elements successfully read from the matrix.

This method reads the specified float array from the matrix at the given indices. The length of the data array must be sufficient to hold the data, and it must be a multiple of the matrix's channel count. The number of indices in idx must match the matrix's dimension count. Only matrices with a data type of CV_32F are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the length of the data array is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_32F.

◆ get() [52/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
float[] data,
int length )

Reads a specified number of float values from the matrix at the given indices.

Parameters
idxThe array of indices corresponding to the dimensions of the matrix.
dataThe float array where the read data elements will be stored.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of float values from the matrix at the given indices. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_32F are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_32F.

◆ get() [53/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
float[] data,
int offset,
int length )

Reads a specified number of float values from the matrix at the given indices, storing them in the data array starting at the specified offset.

Parameters
idxThe array of indices corresponding to the dimensions of the matrix.
dataThe float array where the read data elements will be stored.
offsetThe starting point within the array from which the data will be placed.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of float values from the matrix at the given indices, storing them in the data array starting at the specified offset. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_32F are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_32F.

◆ get() [54/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
int[] data )

Reads an int array from the matrix at the specified indices.

Parameters
idxAn array of indices specifying the location from which the data will be read.
dataThe int array where the read data elements will be stored.
Returns
The number of elements successfully read from the matrix.

This method reads the specified int array from the matrix at the given indices. The length of the data array must be sufficient to hold the data, and it must be a multiple of the matrix's channel count. The number of indices in idx must match the matrix's dimension count. Only matrices with a data type of CV_32S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the length of the data array is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_32S.

◆ get() [55/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
int[] data,
int length )

Reads a specified number of int values from the matrix at the given indices.

Parameters
idxThe array of indices corresponding to the dimensions of the matrix.
dataThe int array where the read data elements will be stored.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of int values from the matrix at the given indices. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_32S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_32S.

◆ get() [56/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
int[] data,
int offset,
int length )

Reads a specified number of int values from the matrix at the given indices, storing them in the data array starting at the specified offset.

Parameters
idxThe array of indices corresponding to the dimensions of the matrix.
dataThe int array where the read data elements will be stored.
offsetThe starting point within the array from which the data will be placed.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of int values from the matrix at the given indices, storing them in the data array starting at the specified offset. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_32S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_32S.

◆ get() [57/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
sbyte[] data )

Reads a sbyte array from the matrix at the specified indices.

Parameters
idxAn array of indices specifying the location from which the data will be read.
dataThe sbyte array where the read data elements will be stored.
Returns
The number of elements successfully read from the matrix.

This method reads the specified sbyte array from the matrix at the given indices. The length of the data array must be sufficient to hold the data, and it must be a multiple of the matrix's channel count. The number of indices in idx must match the matrix's dimension count. Only matrices with a data type of CV_8U or CV_8S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the length of the data array is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_8U or CV_8S.

◆ get() [58/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
sbyte[] data,
int length )

Reads a specified number of sbyte values from the matrix at the given indices.

Parameters
idxThe array of indices corresponding to the dimensions of the matrix.
dataThe sbyte array where the read data elements will be stored.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of sbyte values from the matrix at the given indices. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_8U or CV_8S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_8U or CV_8S.

◆ get() [59/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
sbyte[] data,
int offset,
int length )

Reads a specified number of sbyte values from the matrix at the given indices, storing them in the data array starting at the specified offset.

Parameters
idxThe array of indices corresponding to the dimensions of the matrix.
dataThe sbyte array where the read data elements will be stored.
offsetThe starting point within the array from which the data will be placed.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of sbyte values from the matrix at the given indices, storing them in the data array starting at the specified offset. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_8U or CV_8S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_8U or CV_8S.

◆ get() [60/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
short[] data )

Reads a short array from the matrix at the specified indices.

Parameters
idxAn array of indices specifying the location from which the data will be read.
dataThe short array where the read data elements will be stored.
Returns
The number of elements successfully read from the matrix.

This method reads the specified short array from the matrix at the given indices. The length of the data array must be sufficient to hold the data, and it must be a multiple of the matrix's channel count. The number of indices in idx must match the matrix's dimension count. Only matrices with a data type of CV_16U or CV_16S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the length of the data array is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_16U or CV_16S.

◆ get() [61/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
short[] data,
int length )

Reads a specified number of short values from the matrix at the given indices.

Parameters
idxThe array of indices corresponding to the dimensions of the matrix.
dataThe short array where the read data elements will be stored.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of short values from the matrix at the given indices. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_16U or CV_16S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_16U or CV_16S.

◆ get() [62/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
short[] data,
int offset,
int length )

Reads a specified number of short values from the matrix at the given indices, storing them in the data array starting at the specified offset.

Parameters
idxThe array of indices corresponding to the dimensions of the matrix.
dataThe short array where the read data elements will be stored.
offsetThe starting point within the array from which the data will be placed.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of short values from the matrix at the given indices, storing them in the data array starting at the specified offset. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_16U or CV_16S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_16U or CV_16S.

◆ get() [63/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< byte > data )

Reads a span of byte data from the matrix at the specified indices.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of byte data to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of byte data from the matrix at the given indices. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [64/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< byte > data,
int length )

Reads a span of byte data from the matrix at the specified indices.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of byte data to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of byte data from the matrix at the given indices. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [65/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< byte > data,
int offset,
int length )

Reads a span of byte data from the matrix at the specified indices, storing them in the data span starting at the specified offset.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of byte data to store the read values.
offsetThe offset within the span at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of byte data from the matrix at the given indices, storing them in the data span starting at the specified offset. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [66/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< double > data )

Reads a span of double data from the matrix at the specified indices.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of double data to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of double data from the matrix at the given indices. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [67/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< double > data,
int length )

Reads a span of double data from the matrix at the specified indices.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of double data to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of double data from the matrix at the given indices. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [68/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< double > data,
int offset,
int length )

Reads a span of double data from the matrix at the specified indices, storing them in the data span starting at the specified offset.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of double data to store the read values.
offsetThe offset within the span at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of double data from the matrix at the given indices, storing them in the data span starting at the specified offset. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [69/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< float > data )

Reads a span of float data from the matrix at the specified indices.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of float data to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of float data from the matrix at the given indices. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [70/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< float > data,
int length )

Reads a span of float data from the matrix at the specified indices.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of float data to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of float data from the matrix at the given indices. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [71/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< float > data,
int offset,
int length )

Reads a span of float data from the matrix at the specified indices, storing them in the data span starting at the specified offset.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of float data to store the read values.
offsetThe offset within the span at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of float data from the matrix at the given indices, storing them in the data span starting at the specified offset. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [72/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< int > data )

Reads a span of int data from the matrix at the specified indices.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of int data to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of int data from the matrix at the given indices. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [73/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< int > data,
int length )

Reads a span of int data from the matrix at the specified indices.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of int data to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of int data from the matrix at the given indices. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [74/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< int > data,
int offset,
int length )

Reads a span of int data from the matrix at the specified indices, storing them in the data span starting at the specified offset.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of int data to store the read values.
offsetThe offset within the span at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of int data from the matrix at the given indices, storing them in the data span starting at the specified offset. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [75/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< sbyte > data )

Reads a span of sbyte data from the matrix at the specified indices.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of sbyte data to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of sbyte data from the matrix at the given indices. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [76/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< sbyte > data,
int length )

Reads a span of sbyte data from the matrix at the specified indices.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of sbyte data to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of sbyte data from the matrix at the given indices. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [77/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< sbyte > data,
int offset,
int length )

Reads a span of sbyte data from the matrix at the specified indices, storing them in the data span starting at the specified offset.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of sbyte data to store the read values.
offsetThe offset within the span at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of sbyte data from the matrix at the given indices, storing them in the data span starting at the specified offset. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [78/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< short > data )

Reads a span of short data from the matrix at the specified indices.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of short data to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of short data from the matrix at the given indices. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [79/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< short > data,
int length )

Reads a span of short data from the matrix at the specified indices.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of short data to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of short data from the matrix at the given indices. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [80/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< short > data,
int offset,
int length )

Reads a span of short data from the matrix at the specified indices, storing them in the data span starting at the specified offset.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of short data to store the read values.
offsetThe offset within the span at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of short data from the matrix at the given indices, storing them in the data span starting at the specified offset. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [81/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< ushort > data )

Reads a ushort of byte data from the matrix at the specified indices.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of ushort data to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of ushort data from the matrix at the given indices. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [82/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< ushort > data,
int length )

Reads a span of ushort data from the matrix at the specified indices.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of ushort data to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of ushort data from the matrix at the given indices. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [83/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
Span< ushort > data,
int offset,
int length )

Reads a span of ushort data from the matrix at the specified indices, storing them in the data span starting at the specified offset.

Parameters
idxThe indices in the matrix from which to read data.
dataThe span of ushort data to store the read values.
offsetThe offset within the span at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of ushort data from the matrix at the given indices, storing them in the data span starting at the specified offset. The length of the span read must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ get() [84/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
ushort[] data )

Reads an ushort array from the matrix at the specified indices.

Parameters
idxAn array of indices specifying the location from which the data will be read.
dataThe ushort array where the read data elements will be stored.
Returns
The number of elements successfully read from the matrix.

This method reads the specified ushort array from the matrix at the given indices. The length of the data array must be sufficient to hold the data, and it must be a multiple of the matrix's channel count. The number of indices in idx must match the matrix's dimension count. Only matrices with a data type of CV_16U or CV_16S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the length of the data array is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_16U or CV_16S.

◆ get() [85/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
ushort[] data,
int length )

Reads a specified number of ushort values from the matrix at the given indices.

Parameters
idxThe array of indices corresponding to the dimensions of the matrix.
dataThe ushort array where the read data elements will be stored.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of ushort values from the matrix at the given indices. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_16U or CV_16S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_16U or CV_16S.

◆ get() [86/86]

int OpenCVForUnity.CoreModule.Mat.get ( int[] idx,
ushort[] data,
int offset,
int length )

Reads a specified number of ushort values from the matrix at the given indices, storing them in the data array starting at the specified offset.

Parameters
idxThe array of indices corresponding to the dimensions of the matrix.
dataThe ushort array where the read data elements will be stored.
offsetThe starting point within the array from which the data will be placed.
lengthThe number of elements to read from the matrix.
Returns
The number of elements successfully read from the matrix.

This method reads the specified number of ushort values from the matrix at the given indices, storing them in the data array starting at the specified offset. The number of elements specified by length must be a multiple of the matrix's channel count. Only matrices with a data type of CV_16U or CV_16S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices is incorrect, or if the matrix's data type is not CV_16U or CV_16S.

◆ get< T >() [1/14]

T[] OpenCVForUnity.CoreModule.Mat.get< T > ( int row,
int col )

Reads the element values from the matrix at the specified row and column, returning them as an array of type T .

Template Parameters
TThe unmanaged type of the data to be read.
Parameters
rowThe row index from which the data will be read.
colThe column index from which the data will be read.
Returns
An array of type T representing the matrix element(s) at the specified row and column. The size of the returned array corresponds to the number of matrix element bytes divided by the size of type T . If the read operation fails, returns null.

This method reads the element values at the specified row and column in the matrix and returns them as values of type T . Regardless of the matrix's actual data type, the values are cast to the specified type T . The size of the returned array depends on how many values of type T can fit into the total byte size of the matrix element.

Exceptions
CvExceptionThrown if the matrix is disposed or if the size of the provided type T is not compatible with the matrix element size.
Type Constraints
T :unmanaged 

◆ get< T >() [2/14]

int OpenCVForUnity.CoreModule.Mat.get< T > ( int row,
int col,
Span< T > data )

Reads a span of type T from the matrix at the specified row and column.

Template Parameters
TThe unmanaged type of the data to be read.
Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of type T to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of type T from the matrix at the given row and column. The size of the type T must be compatible with the matrix element size.

Exceptions
CvExceptionThrown if the matrix is disposed or if the size of the provided type T is not compatible with the matrix element size.
Type Constraints
T :unmanaged 

◆ get< T >() [3/14]

int OpenCVForUnity.CoreModule.Mat.get< T > ( int row,
int col,
Span< T > data,
int length )

Reads a span of type T from the matrix at the specified row and column.

Template Parameters
TThe unmanaged type of the data to be read.
Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of type T to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of type T from the matrix at the given row and column. The size of the type T must be compatible with the matrix element size.

Exceptions
CvExceptionThrown if the matrix is disposed or if the size of the provided type T is not compatible with the matrix element size.
Type Constraints
T :unmanaged 

◆ get< T >() [4/14]

int OpenCVForUnity.CoreModule.Mat.get< T > ( int row,
int col,
Span< T > data,
int offset,
int length )

Reads a span of type T from the matrix at the specified row and column, storing them in the data span starting at the specified offset.

Template Parameters
TThe unmanaged type of the data to be read.
Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe span of type T to store the read values.
offsetThe offset within the span at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of type T from the matrix at the given row and column, storing them in the data span starting at the specified offset. The size of the type T must be compatible with the matrix element size.

Exceptions
CvExceptionThrown if the matrix is disposed or if the size of the provided type T is not compatible with the matrix element size.
Type Constraints
T :unmanaged 

◆ get< T >() [5/14]

int OpenCVForUnity.CoreModule.Mat.get< T > ( int row,
int col,
T[] data )

Reads an array of type T from the matrix at the specified row and column.

Template Parameters
TThe unmanaged type of the data to be read.
Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe array of type T to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified array of type T from the matrix at the given row and column. The size of the type T must be compatible with the matrix element size.

Exceptions
CvExceptionThrown if the matrix is disposed or if the size of the provided type T is not compatible with the matrix element size.
Type Constraints
T :unmanaged 

◆ get< T >() [6/14]

int OpenCVForUnity.CoreModule.Mat.get< T > ( int row,
int col,
T[] data,
int length )

Reads an array of type T from the matrix at the specified row and column.

Template Parameters
TThe unmanaged type of the data to be read.
Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe array of type T to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified array of type T from the matrix at the given row and column. The size of the type T must be compatible with the matrix element size.

Exceptions
CvExceptionThrown if the matrix is disposed or if the size of the provided type T is not compatible with the matrix element size.
Type Constraints
T :unmanaged 

◆ get< T >() [7/14]

int OpenCVForUnity.CoreModule.Mat.get< T > ( int row,
int col,
T[] data,
int offset,
int length )

Reads an array of type T from the matrix at the specified row and column, storing them in the data array starting at the specified offset.

Template Parameters
TThe unmanaged type of the data to be read.
Parameters
rowThe row index in the matrix from which to read data.
colThe column index in the matrix from which to read data.
dataThe array of type T to store the read values.
offsetThe offset within the array at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified array of type T from the matrix at the given row and column, storing them in the data array starting at the specified offset. The size of the type T must be compatible with the matrix element size.

Exceptions
CvExceptionThrown if the matrix is disposed or if the size of the provided type T is not compatible with the matrix element size.
Type Constraints
T :unmanaged 

◆ get< T >() [8/14]

T[] OpenCVForUnity.CoreModule.Mat.get< T > ( int[] idx)

Reads the element values from the matrix at the specified indices, returning them as an array of type T .

Template Parameters
TThe unmanaged type of the data to be read.
Parameters
idxAn array of indices specifying the location from which the data will be read.
Returns
An array of type T representing the matrix element(s) at the specified indices. The size of the returned array corresponds to the number of matrix element bytes divided by the size of type T . If the read operation fails, returns null.

This method reads the element values at the specified indices in the matrix and returns them as values of type T . Regardless of the matrix's actual data type, the values are cast to the specified type T . The size of the returned array depends on how many values of type T can fit into the total byte size of the matrix element.

Exceptions
CvExceptionThrown if the matrix is disposed or if the size of the provided type T is not compatible with the matrix element size.
Type Constraints
T :unmanaged 

◆ get< T >() [9/14]

int OpenCVForUnity.CoreModule.Mat.get< T > ( int[] idx,
Span< T > data )

Reads a span of type T from the matrix at the specified indices.

Template Parameters
TThe unmanaged type of the data to be read.
Parameters
idxThe indices in the matrix from which to read data.
dataThe span of type T to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of type T from the matrix at the given indices. The size of the type T must be compatible with the matrix element size.

Exceptions
CvExceptionThrown if the matrix is disposed or if the size of the provided type T is not compatible with the matrix element size.
Type Constraints
T :unmanaged 

◆ get< T >() [10/14]

int OpenCVForUnity.CoreModule.Mat.get< T > ( int[] idx,
Span< T > data,
int length )

Reads a span of type T from the matrix at the specified indices.

Template Parameters
TThe unmanaged type of the data to be read.
Parameters
idxThe indices in the matrix from which to read data.
dataThe span of type T to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of type T from the matrix at the given indices. The size of the type T must be compatible with the matrix element size.

Exceptions
CvExceptionThrown if the matrix is disposed or if the size of the provided type T is not compatible with the matrix element size.
Type Constraints
T :unmanaged 

◆ get< T >() [11/14]

int OpenCVForUnity.CoreModule.Mat.get< T > ( int[] idx,
Span< T > data,
int offset,
int length )

Reads a span of type T from the matrix at the specified indices, storing them in the data span starting at the specified offset.

Template Parameters
TThe unmanaged type of the data to be read.
Parameters
idxThe indices in the matrix from which to read data.
dataThe span of type T to store the read values.
offsetThe offset within the span at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified span of type T from the matrix at the given indices, storing them in the data span starting at the specified offset. The size of the type T must be compatible with the matrix element size.

Exceptions
CvExceptionThrown if the matrix is disposed or if the size of the provided type T is not compatible with the matrix element size.
Type Constraints
T :unmanaged 

◆ get< T >() [12/14]

int OpenCVForUnity.CoreModule.Mat.get< T > ( int[] idx,
T[] data )

Reads an array of type T from the matrix at the specified indices.

Template Parameters
TThe unmanaged type of the data to be read.
Parameters
idxThe indices in the matrix from which to read data.
dataThe array of type T to store the read values.
Returns
The number of elements successfully read from the matrix.

This method reads the specified array of type T from the matrix at the given indices. The size of the type T must be compatible with the matrix element size.

Exceptions
CvExceptionThrown if the matrix is disposed or if the size of the provided type T is not compatible with the matrix element size.
Type Constraints
T :unmanaged 

◆ get< T >() [13/14]

int OpenCVForUnity.CoreModule.Mat.get< T > ( int[] idx,
T[] data,
int length )

Reads an array of type T from the matrix at the specified indices.

Template Parameters
TThe unmanaged type of the data to be read.
Parameters
idxThe indices in the matrix from which to read data.
dataThe array of type T to store the read values.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified array of type T from the matrix at the given indices. The size of the type T must be compatible with the matrix element size.

Exceptions
CvExceptionThrown if the matrix is disposed or if the size of the provided type T is not compatible with the matrix element size.
Type Constraints
T :unmanaged 

◆ get< T >() [14/14]

int OpenCVForUnity.CoreModule.Mat.get< T > ( int[] idx,
T[] data,
int offset,
int length )

Reads an array of type T from the matrix at the specified indices, storing them in the data array starting at the specified offset.

Template Parameters
TThe unmanaged type of the data to be read.
Parameters
idxThe indices in the matrix from which to read data.
dataThe array of type T to store the read values.
offsetThe offset within the array at which to start storing the read data.
lengthThe number of elements to read.
Returns
The number of elements successfully read from the matrix.

This method reads the specified array of type T from the matrix at the given indices, storing them in the data array starting at the specified offset. The size of the type T must be compatible with the matrix element size.

Exceptions
CvExceptionThrown if the matrix is disposed or if the size of the provided type T is not compatible with the matrix element size.
Type Constraints
T :unmanaged 

◆ getNativeObjAddr()

IntPtr OpenCVForUnity.CoreModule.Mat.getNativeObjAddr ( )

◆ height()

int OpenCVForUnity.CoreModule.Mat.height ( )

Returns the number of rows in the matrix.

The method returns the number of rows in the matrix, which corresponds to the height of the image represented by the matrix. If the matrix is empty (i.e., it has no elements), the method will return 0.

Returns
The number of rows in the matrix.

◆ inv() [1/2]

Mat OpenCVForUnity.CoreModule.Mat.inv ( )

Inverses a matrix.

The method performs a matrix inversion by means of matrix expressions. This means that a temporary matrix inversion object is returned by the method and can be used further as a part of more complex matrix expressions or can be assigned to a matrix.

◆ inv() [2/2]

Mat OpenCVForUnity.CoreModule.Mat.inv ( int method)

Inverses a matrix.

The method performs a matrix inversion by means of matrix expressions. This means that a temporary matrix inversion object is returned by the method and can be used further as a part of more complex matrix expressions or can be assigned to a matrix.

Parameters
methodMatrix inversion method. One of cv::DecompTypes

◆ isContinuous()

bool OpenCVForUnity.CoreModule.Mat.isContinuous ( )

Reports whether the matrix is continuous or not.

The method returns true if the matrix elements are stored continuously without gaps at the end of each row. Otherwise, it returns false. Obviously, 1x1 or 1xN matrices are always continuous. Matrices created with Mat.create are always continuous. But if you extract a part of the matrix using Mat.col, Mat.diag, and so on, or constructed a matrix header for externally allocated data, such matrices may no longer have this property.

The continuity flag is stored as a bit in the Mat::flags field and is computed automatically when you construct a matrix header. Thus, the continuity check is a very fast operation, though theoretically it could be done as follows:

// alternative implementation of Mat::isContinuous()
bool myCheckMatContinuity(const Mat&amp; m)
{
//return (m.flags &amp; Mat::CONTINUOUS_FLAG) != 0;
return m.rows == 1 || m.step == m.cols*m.elemSize();
}

The method is used in quite a few of OpenCV functions. The point is that element-wise operations (such as arithmetic and logical operations, math functions, alpha blending, color space transformations, and others) do not depend on the image geometry. Thus, if all the input and output arrays are continuous, the functions can process them as very long single-row vectors. The example below illustrates how an alpha-blending function can be implemented:

template<typename T>
void alphaBlendRGBA(const Mat&amp; src1, const Mat&amp; src2, Mat&amp; dst)
{
const float alpha_scale = (float)std::numeric_limits<T>::max(),
inv_scale = 1.f/alpha_scale;
CV_Assert( src1.type() == src2.type() &amp;&amp;
src1.type() == CV_MAKETYPE(traits::Depth<T>::value, 4) &amp;&amp;
src1.size() == src2.size());
Size size = src1.size();
dst.create(size, src1.type());
// here is the idiom: check the arrays for continuity and,
// if this is the case,
// treat the arrays as 1D vectors
if( src1.isContinuous() &amp;&amp; src2.isContinuous() &amp;&amp; dst.isContinuous() )
{
size.width *= size.height;
size.height = 1;
}
size.width *= 4;
for( int i = 0; i < size.height; i++ )
{
// when the arrays are continuous,
// the outer loop is executed only once
const T* ptr1 = src1.ptr<T>(i);
const T* ptr2 = src2.ptr<T>(i);
T* dptr = dst.ptr<T>(i);
for( int j = 0; j < size.width; j += 4 )
{
float alpha = ptr1[j+3]*inv_scale, beta = ptr2[j+3]*inv_scale;
dptr[j] = saturate_cast<T>(ptr1[j]*alpha + ptr2[j]*beta);
dptr[j+1] = saturate_cast<T>(ptr1[j+1]*alpha + ptr2[j+1]*beta);
dptr[j+2] = saturate_cast<T>(ptr1[j+2]*alpha + ptr2[j+2]*beta);
dptr[j+3] = saturate_cast<T>((1 - (1-alpha)*(1-beta))*alpha_scale);
}
}
}
Template class for specifying the size of an image or rectangle.
Definition Size_Ex.cs:7
double height
Definition Size.cs:26
double width
Definition Size.cs:21

This approach, while being very simple, can boost the performance of a simple element-operation by 10-20 percents, especially if the image is rather small and the operation is quite simple.

Another OpenCV idiom in this function, a call of Mat.create for the destination array, that allocates the destination array unless it already has the proper size and type. And while the newly allocated arrays are always continuous, you still need to check the destination array because Mat.create does not always allocate a new matrix.

◆ isSubmatrix()

bool OpenCVForUnity.CoreModule.Mat.isSubmatrix ( )

returns true if the matrix is a submatrix of another matrix

◆ locateROI() [1/3]

void OpenCVForUnity.CoreModule.Mat.locateROI ( out Vec2d wholeSize,
out Vec2d ofs )

Locates the matrix header within a parent matrix.

After you extracted a submatrix from a matrix using Mat.row, Mat.col, Mat.rowRange, Mat.colRange, and others, the resultant submatrix points just to the part of the original big matrix. However, each submatrix contains information (represented by datastart and dataend fields) that helps reconstruct the original matrix size and the position of the extracted submatrix within the original matrix. The method locateROI does exactly that.

Parameters
wholeSizeOutput parameter that contains the size of the whole matrix containing this as a part.
ofsOutput parameter that contains an offset of this inside the whole matrix.

◆ locateROI() [2/3]

void OpenCVForUnity.CoreModule.Mat.locateROI ( out(double width, double height) wholeSize,
out(double x, double y) ofs )

Locates the matrix header within a parent matrix.

After you extracted a submatrix from a matrix using Mat.row, Mat.col, Mat.rowRange, Mat.colRange, and others, the resultant submatrix points just to the part of the original big matrix. However, each submatrix contains information (represented by datastart and dataend fields) that helps reconstruct the original matrix size and the position of the extracted submatrix within the original matrix. The method locateROI does exactly that.

Parameters
wholeSizeOutput parameter that contains the size of the whole matrix containing this as a part.
ofsOutput parameter that contains an offset of this inside the whole matrix.

◆ locateROI() [3/3]

void OpenCVForUnity.CoreModule.Mat.locateROI ( Size wholeSize,
Point ofs )

Locates the matrix header within a parent matrix.

After you extracted a submatrix from a matrix using Mat.row, Mat.col, Mat.rowRange, Mat.colRange, and others, the resultant submatrix points just to the part of the original big matrix. However, each submatrix contains information (represented by datastart and dataend fields) that helps reconstruct the original matrix size and the position of the extracted submatrix within the original matrix. The method locateROI does exactly that.

Parameters
wholeSizeOutput parameter that contains the size of the whole matrix containing this as a part.
ofsOutput parameter that contains an offset of this inside the whole matrix.

◆ matMul()

Mat OpenCVForUnity.CoreModule.Mat.matMul ( Mat m)

Matrix multiplication

Parameters
moperand with with which to perform matrix multiplication
Returns
reference to a new Mat object

◆ mul() [1/2]

Mat OpenCVForUnity.CoreModule.Mat.mul ( Mat m)

Element-wise multiplication.

Parameters
moperand with with which to perform element-wise multiplication
Returns
reference to a new Mat object

◆ mul() [2/2]

Mat OpenCVForUnity.CoreModule.Mat.mul ( Mat m,
double scale )

Performs an element-wise multiplication or division of the two matrices.

The method returns a temporary object encoding per-element array multiplication, with optional scale. Note that this is not a matrix multiplication that corresponds to a simpler "*" operator.

Example:

Mat C = A.mul(5/B); // equivalent to divide(A, B, C, 5)
Mat mul(Mat m, double scale)
Performs an element-wise multiplication or division of the two matrices.
Definition Mat.cs:1764
Parameters
mAnother array of the same type and the same size as *this, or a matrix expression.
scaleOptional scale factor.

◆ ones() [1/5]

static Mat OpenCVForUnity.CoreModule.Mat.ones ( in Vec2d size,
int type )
static

Returns an array of all 1's of the specified size and type.

The method returns a Matlab-style 1's array initializer, similarly to Mat.zeros. Note that using this method you can initialize an array with an arbitrary value, using the following Matlab idiom:

Mat A = Mat::ones(100, 100, CV_8U)*3; // make 100x100 matrix filled with 3.
static Mat ones(int rows, int cols, int type)
Returns an array of all 1's of the specified size and type.
Definition Mat.cs:1835

The above operation does not form a 100x100 matrix of 1's and then multiply it by 3. Instead, it just remembers the scale factor (3 in this case) and use it when actually invoking the matrix initializer.

Note
In case of multi-channels type, only the first channel will be initialized with 1's, the others will be set to 0's.
Parameters
sizeAlternative to the matrix size specification Size(cols, rows) .
typeCreated matrix type.

◆ ones() [2/5]

static Mat OpenCVForUnity.CoreModule.Mat.ones ( in(double width, double height) size,
int type )
static

Returns an array of all 1's of the specified size and type.

The method returns a Matlab-style 1's array initializer, similarly to Mat.zeros. Note that using this method you can initialize an array with an arbitrary value, using the following Matlab idiom:

Mat A = Mat::ones(100, 100, CV_8U)*3; // make 100x100 matrix filled with 3.

The above operation does not form a 100x100 matrix of 1's and then multiply it by 3. Instead, it just remembers the scale factor (3 in this case) and use it when actually invoking the matrix initializer.

Note
In case of multi-channels type, only the first channel will be initialized with 1's, the others will be set to 0's.
Parameters
sizeAlternative to the matrix size specification Size(cols, rows) .
typeCreated matrix type.

◆ ones() [3/5]

static Mat OpenCVForUnity.CoreModule.Mat.ones ( int rows,
int cols,
int type )
static

Returns an array of all 1's of the specified size and type.

The method returns a Matlab-style 1's array initializer, similarly to Mat.zeros. Note that using this method you can initialize an array with an arbitrary value, using the following Matlab idiom:

Mat A = Mat::ones(100, 100, CV_8U)*3; // make 100x100 matrix filled with 3.

The above operation does not form a 100x100 matrix of 1's and then multiply it by 3. Instead, it just remembers the scale factor (3 in this case) and use it when actually invoking the matrix initializer.

Note
In case of multi-channels type, only the first channel will be initialized with 1's, the others will be set to 0's.
Parameters
rowsNumber of rows.
colsNumber of columns.
typeCreated matrix type.

◆ ones() [4/5]

static Mat OpenCVForUnity.CoreModule.Mat.ones ( int[] sizes,
int type )
static

Returns an array of all 1's of the specified size and type.

The method returns a Matlab-style 1's array initializer, similarly to Mat.zeros. Note that using this method you can initialize an array with an arbitrary value, using the following Matlab idiom:

Mat A = Mat::ones(100, 100, CV_8U)*3; // make 100x100 matrix filled with 3.

The above operation does not form a 100x100 matrix of 1's and then multiply it by 3. Instead, it just remembers the scale factor (3 in this case) and use it when actually invoking the matrix initializer.

Note
In case of multi-channels type, only the first channel will be initialized with 1's, the others will be set to 0's.
Parameters
sizesArray of integers specifying an n-dimensional array shape.
typeCreated matrix type.

◆ ones() [5/5]

static Mat OpenCVForUnity.CoreModule.Mat.ones ( Size size,
int type )
static

Returns an array of all 1's of the specified size and type.

The method returns a Matlab-style 1's array initializer, similarly to Mat.zeros. Note that using this method you can initialize an array with an arbitrary value, using the following Matlab idiom:

Mat A = Mat::ones(100, 100, CV_8U)*3; // make 100x100 matrix filled with 3.

The above operation does not form a 100x100 matrix of 1's and then multiply it by 3. Instead, it just remembers the scale factor (3 in this case) and use it when actually invoking the matrix initializer.

Note
In case of multi-channels type, only the first channel will be initialized with 1's, the others will be set to 0's.
Parameters
sizeAlternative to the matrix size specification Size(cols, rows) .
typeCreated matrix type.

◆ operator&() [1/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator& ( Mat a,
Mat b )
static

Performs a bitwise AND operation between two matrices.

Parameters
aThe first matrix.
bThe second matrix.
Returns
A new matrix that is the result of the bitwise AND operation between a and b .

This operator performs an element-wise bitwise AND operation between the matrices a and b and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator&() [2/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator& ( Mat a,
Scalar s )
static

Performs a bitwise AND operation between a matrix and a scalar.

Parameters
aThe matrix.
sThe scalar value.
Returns
A new matrix that is the result of the bitwise AND operation between a and s .

This operator performs an element-wise bitwise AND operation between the matrix a and the scalar s and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator&() [3/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator& ( Scalar s,
Mat a )
static

Performs a bitwise AND operation between a scalar and a matrix.

Parameters
sThe scalar value.
aThe matrix.
Returns
A new matrix that is the result of the bitwise AND operation between s and a .

This operator performs an element-wise bitwise AND operation between the scalar s and the matrix a and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator*() [1/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator* ( double s,
Mat a )
static

Multiplies a matrix by a scalar value.

Parameters
aThe matrix to be multiplied.
sThe scalar value to multiply the matrix by.
Returns
A new matrix that is the result of multiplying a by s .

This operator performs element-wise multiplication of the matrix a by the scalar s and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator*() [2/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator* ( Mat a,
double s )
static

Multiplies a matrix by a scalar value.

Parameters
aThe matrix to be multiplied.
sThe scalar value to multiply the matrix by.
Returns
A new matrix that is the result of multiplying a by s .

This operator performs element-wise multiplication of the matrix a by the scalar s and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator*() [3/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator* ( Mat a,
Mat b )
static

Multiplies two matrices using the General Matrix Multiply (GEMM) operation.

Parameters
aThe first matrix.
bThe second matrix.
Returns
A new matrix that is the result of multiplying a by b .

This operator performs matrix multiplication of the matrices a and b using the GEMM function and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator+() [1/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator+ ( Mat a,
Mat b )
static

Adds two matrices element-wise.

Parameters
aThe first input matrix.
bThe second input matrix.
Returns
A new matrix that is the sum of the two input matrices.

This operator performs element-wise addition of the matrices a and b and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator+() [2/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator+ ( Mat a,
Scalar s )
static

Adds a scalar value to each element of the matrix.

Parameters
aThe input matrix.
sThe scalar value to add.
Returns
A new matrix that is the result of adding the scalar to each element of the input matrix.

This operator performs element-wise addition of the matrix a and the scalar s and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator+() [3/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator+ ( Scalar s,
Mat a )
static

Adds a scalar value to each element of the matrix.

Parameters
sThe scalar value to add.
aThe input matrix.
Returns
A new matrix that is the result of adding the scalar to each element of the input matrix.

This operator performs element-wise addition of the scalar s and the matrix a and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator-() [1/4]

static Mat OpenCVForUnity.CoreModule.Mat.operator- ( Mat a)
static

Negates all elements of the matrix.

Parameters
aThe input matrix to be negated.
Returns
A new matrix where each element is the negation of the corresponding element in the input matrix.

This operator negates all elements in the matrix a by multiplying them by -1. A new Mat object is created and returned.

◆ operator-() [2/4]

static Mat OpenCVForUnity.CoreModule.Mat.operator- ( Mat a,
Mat b )
static

Subtracts one matrix from another.

Parameters
aThe minuend matrix.
bThe subtrahend matrix.
Returns
A new matrix that is the result of subtracting b from a .

This operator performs element-wise subtraction of the matrix b from the matrix a and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator-() [3/4]

static Mat OpenCVForUnity.CoreModule.Mat.operator- ( Mat a,
Scalar s )
static

Subtracts a scalar value from each element of the matrix.

Parameters
aThe matrix from which the scalar will be subtracted.
sThe scalar value to subtract from each element of the matrix.
Returns
A new matrix that is the result of subtracting s from each element of a .

This operator performs element-wise subtraction of the scalar s from the matrix a and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator-() [4/4]

static Mat OpenCVForUnity.CoreModule.Mat.operator- ( Scalar s,
Mat a )
static

Subtracts a scalar value from each element of the matrix.

Parameters
aThe matrix from which the scalar will be subtracted.
sThe scalar value to subtract from each element of the matrix.
Returns
A new matrix that is the result of subtracting s from each element of a .

This operator performs element-wise subtraction of the scalar s from the matrix a and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator/() [1/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator/ ( double s,
Mat a )
static

Divides a scalar value by a matrix.

Parameters
sThe scalar value (dividend).
aThe divisor matrix.
Returns
A new matrix that is the result of dividing the scalar s by the matrix a .

This operator creates a new matrix filled with the scalar value s and performs element-wise division of this matrix by a . It returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator/() [2/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator/ ( Mat a,
double s )
static

Divides a matrix by a scalar value.

Parameters
aThe dividend matrix.
sThe scalar value (divisor).
Returns
A new matrix that is the result of dividing the matrix a by the scalar s .

This operator performs element-wise division of the matrix a by the scalar s and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator/() [3/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator/ ( Mat a,
Mat b )
static

Divides one matrix by another.

Parameters
aThe dividend matrix.
bThe divisor matrix.
Returns
A new matrix that is the result of dividing a by b .

This operator performs element-wise division of the matrix a by the matrix b and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator^() [1/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator^ ( Mat a,
Mat b )
static

Performs a bitwise XOR operation between two matrices.

Parameters
aThe first matrix.
bThe second matrix.
Returns
A new matrix that is the result of the bitwise XOR operation between a and b .

This operator performs an element-wise bitwise XOR operation between the two matrices a and b and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator^() [2/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator^ ( Mat a,
Scalar s )
static

Performs a bitwise XOR operation between a matrix and a scalar value.

Parameters
aThe matrix.
sThe scalar value.
Returns
A new matrix that is the result of the bitwise XOR operation between a and s .

This operator performs an element-wise bitwise XOR operation between the matrix a and the scalar s and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator^() [3/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator^ ( Scalar s,
Mat a )
static

Performs a bitwise XOR operation between a scalar value and a matrix.

Parameters
sThe scalar value.
aThe matrix.
Returns
A new matrix that is the result of the bitwise XOR operation between s and a .

This operator performs an element-wise bitwise XOR operation between the scalar s and the matrix a and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator|() [1/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator| ( Mat a,
Mat b )
static

Performs a bitwise OR operation between two matrices.

Parameters
aThe first matrix.
bThe second matrix.
Returns
A new matrix that is the result of the bitwise OR operation between a and b .

This operator performs an element-wise bitwise OR operation between the two matrices a and b and returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator|() [2/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator| ( Mat a,
Scalar s )
static

Performs a bitwise OR operation between a matrix and a scalar value.

Parameters
aThe matrix.
sThe scalar value.
Returns
A new matrix that is the result of the bitwise OR operation between a and the scalar s .

This operator performs an element-wise bitwise OR operation between the matrix a and a new matrix created from the scalar s . The new matrix has the same size and type as a . It returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator|() [3/3]

static Mat OpenCVForUnity.CoreModule.Mat.operator| ( Scalar s,
Mat a )
static

Performs a bitwise OR operation between a scalar value and a matrix.

Parameters
sThe scalar value.
aThe matrix.
Returns
A new matrix that is the result of the bitwise OR operation between the scalar s and the matrix a .

This operator performs an element-wise bitwise OR operation between a new matrix created from the scalar s and the matrix a . The new matrix has the same size and type as a . It returns a new Mat object containing the result.

Note: In C++, the left-hand operand of compound assignment operators like "<c>A += B</c>" is reused, and operations such as "<c>Core.add(A, B, A)</c>" are performed internally. However, in C#, it is not possible to explicitly overload compound assignment operators. Instead, binary operator overloading is used implicitly, which results in a new Mat object being created and assigned to A each time an operator is used. This behavior leads to different memory management between C++ and C#.

◆ operator~()

static Mat OpenCVForUnity.CoreModule.Mat.operator~ ( Mat a)
static

Performs a bitwise NOT operation on the matrix.

Parameters
aThe input matrix.
Returns
A new matrix with each bit in the input matrix inverted.

This operator applies a bitwise NOT operation to the matrix a and returns a new Mat object with each bit in the matrix inverted.

◆ ptr() [1/4]

IntPtr OpenCVForUnity.CoreModule.Mat.ptr ( int i0)

Returns a pointer to the specified row of the Mat object.

This method returns a pointer to the data at the specified row index in a multi-dimensional OpenCV Mat object. It performs basic checks to ensure the Mat has not been disposed, but does not perform bounds checking on the specified index.

The pointer returned points to the first element of the specified row, allowing for direct manipulation of the underlying data.

Note: If the row index is out of bounds, an invalid or out-of-bounds pointer may be returned, leading to undefined behavior.

Parameters
i0The row index of the Mat from which the pointer should be returned. Must be within the valid range of rows.
Returns
A pointer (IntPtr) to the data at the specified row of the Mat.

◆ ptr() [2/4]

IntPtr OpenCVForUnity.CoreModule.Mat.ptr ( int i0,
int i1 )

Returns a pointer to the specified row and column of the Mat object.

This method returns a pointer to the data at the specified row and column indices in a multi-dimensional OpenCV Mat object. It ensures that the Mat is valid and not disposed, but does not perform bounds checking on the specified indices.

The pointer returned points to the first element at the specified row and column, enabling direct manipulation of the underlying data.

Note: If the indices are out of bounds, an invalid or out-of-bounds pointer may be returned, leading to undefined behavior.

Parameters
i0The row index of the Mat from which the pointer should be returned. Must be within the valid range of rows.
i1The column index of the Mat from which the pointer should be returned. Must be within the valid range of columns.
Returns
A pointer (IntPtr) to the data at the specified row and column of the Mat.

◆ ptr() [3/4]

IntPtr OpenCVForUnity.CoreModule.Mat.ptr ( int i0,
int i1,
int i2 )

Returns a pointer to the specified element of the Mat object based on the given row, column, and third dimension indices.

This method returns a pointer to the data at the specified row, column, and third dimension indices in a multi-dimensional OpenCV Mat object. It verifies that the Mat is not disposed but does not check the validity of the indices provided.

The pointer returned allows direct manipulation of the data at the specified coordinates.

Note: If any of the indices are out of bounds, an invalid or out-of-bounds pointer may be returned, resulting in undefined behavior.

Parameters
i0The row index of the Mat from which the pointer should be returned. Must be within the valid range of rows.
i1The column index of the Mat from which the pointer should be returned. Must be within the valid range of columns.
i2The third dimension index of the Mat from which the pointer should be returned. Must be within the valid range of third dimension.
Returns
A pointer (IntPtr) to the data at the specified row, column, and third dimension of the Mat.

◆ ptr() [4/4]

IntPtr OpenCVForUnity.CoreModule.Mat.ptr ( params int[] idx)

Returns a pointer to the specified element of the Mat object based on the provided indices for each dimension.

This method returns a pointer to the data at the specified multi-dimensional indices in an OpenCV Mat object. It ensures that the Mat is valid and not disposed, but does not perform bounds checking on the provided indices.

The pointer returned allows direct manipulation of the data at the coordinates specified by the indices.

Note: If any of the indices are out of bounds, an invalid or out-of-bounds pointer may be returned, leading to undefined behavior. Ensure that the provided indices are within the valid range for each dimension of the Mat.

Parameters
idxAn array of indices specifying the coordinates in the Mat across all dimensions. Each index must be within the valid range of its respective dimension.
Returns
A pointer (IntPtr) to the data at the specified coordinates in the Mat.

◆ push_back()

void OpenCVForUnity.CoreModule.Mat.push_back ( Mat m)

Adds elements to the bottom of the matrix.

The methods add one or more elements to the bottom of the matrix. They emulate the corresponding method of the STL vector class. When elem is Mat, its type and the number of columns must be the same as in the container matrix.

Parameters
mAdded line(s).

◆ put() [1/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
byte[] data )

Writes a byte array to the matrix at the specified row and column.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe byte array containing the data elements to write.
Returns
The number of elements successfully written to the matrix.

This method writes the specified byte array to the matrix at the given row and column. The number of elements in the data array must be a multiple of the matrix's channel count. Only matrices with a data type of CV_8U or CV_8S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_8U or CV_8S.

◆ put() [2/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
byte[] data,
int length )

Writes a byte array to the matrix at a specified row and column.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe byte array containing the data elements to write.
lengthThe number of elements to write from the byte array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified byte array to the matrix at the given row and column. The number of elements specified by length must be a multiple of the matrix channel count. If the matrix's data type is not CV_8U or CV_8S, an exception will be thrown.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible with byte data.

◆ put() [3/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
byte[] data,
int offset,
int length )

Writes a specified number of byte values to the matrix at the given row and column, starting from the specified offset within the data array.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe byte array containing the data elements to write.
offsetThe offset in the data array from which to start writing elements.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of byte values to the matrix at the provided row and column indices, starting from the specified offset within the data array. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_8U or CV_8S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_8U or CV_8S.

◆ put() [4/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
double[] data,
int length )

Writes a specified number of double values to the matrix at the given row and column, casting them to match the matrix's data type.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe double array containing the data elements to write.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of double values to the matrix at the provided row and column indices. The values are automatically cast to match the matrix's data type. The number of elements written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the data array is null, or if the number of elements is not a multiple of the matrix's channel count.

◆ put() [5/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
double[] data,
int offset,
int length )

Writes a specified number of double values to the matrix at the given row and column, starting from the specified offset within the data array, casting them to match the matrix's data type.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe double array containing the data elements to write.
offsetThe offset in the data array from which to start writing elements.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of double values to the matrix at the provided row and column indices, starting from the specified offset within the data array. The values are automatically cast to match the matrix's data type. The number of elements written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the data array is null, or if the number of elements is not a multiple of the matrix's channel count.

◆ put() [6/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
float[] data )

Writes a float array to the matrix at a specified row and column.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe float array containing the data elements to write.
Returns
The number of elements successfully written to the matrix.

This method writes the specified float array to the matrix at the given row and column. The number of elements in the data array must be a multiple of the matrix's channel count. Only matrices with a data type of CV_32F are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_32F.

◆ put() [7/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
float[] data,
int length )

Writes a specified number of float values to the matrix at the given row and column.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe float array containing the data elements to write.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of float values to the matrix at the provided row and column indices. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_32F for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_32F.

◆ put() [8/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
float[] data,
int offset,
int length )

Writes a specified number of float values to the matrix at the given row and column, starting from the specified offset within the data array.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe float array containing the data elements to write.
offsetThe offset in the data array from which to start writing elements.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of float values to the matrix at the provided row and column indices, starting from the specified offset within the data array. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_32F for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_32F.

◆ put() [9/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
int[] data )

Writes an int array to the matrix at the specified row and column.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe int array containing the data elements to write.
Returns
The number of elements successfully written to the matrix.

This method writes the specified int array to the matrix at the given row and column indices. The number of elements in the data array must be a multiple of the matrix's channel count. Only matrices with a data type of CV_32S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_32S.

◆ put() [10/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
int[] data,
int length )

Writes a specified number of int values to the matrix at the given row and column.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe int array containing the data elements to write.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of int values to the matrix at the provided row and column indices. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_32S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_32S.

◆ put() [11/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
int[] data,
int offset,
int length )

Writes a specified number of int values to the matrix at the given row and column, starting from the specified offset within the data array.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe int array containing the data elements to write.
offsetThe offset in the data array from which to start writing elements.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of int values to the matrix at the provided row and column indices, starting from the specified offset within the data array. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_32S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_32S.

◆ put() [12/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
params double[] data )

Writes a double array to the matrix at the given row and column, casting them to match the matrix's data type.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe double array containing the data elements to write.
Returns
The number of elements successfully written to the matrix.

This method writes the specified double array to the matrix at the provided row and column indices. The values are automatically cast to match the matrix's data type. The number of elements written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the data array is null, or if the number of elements is not a multiple of the matrix's channel count.

◆ put() [13/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
sbyte[] data )

Writes a sbyte array to the matrix at the specified row and column.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe sbyte array containing the data elements to write.
Returns
The number of elements successfully written to the matrix.

This method writes the specified sbyte array to the matrix at the specified position. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_8U or CV_8S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, or if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_8U or CV_8S.

◆ put() [14/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
sbyte[] data,
int length )

Writes a specified number of sbyte values to the matrix at the given row and column.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe sbyte array containing the data elements to write.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of sbyte values to the matrix at the provided row and column indices. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_8U or CV_8S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_8U or CV_8S.

◆ put() [15/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
sbyte[] data,
int offset,
int length )

Writes a specified number of sbyte values to the matrix at the given row and column, starting from the specified offset within the data array.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe sbyte array containing the data elements to write.
offsetThe offset in the data array from which to start writing elements.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of sbyte values to the matrix at the provided row and column indices, starting from the specified offset within the data array. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_8U or CV_8S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_8U or CV_8S.

◆ put() [16/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
short[] data )

Writes a short array to the matrix at the specified row and column.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe short array containing the data elements to write.
Returns
The number of elements successfully written to the matrix.

This method writes the specified short array to the matrix at the given row and column. The number of elements in the data array must be a multiple of the matrix's channel count. Only matrices with a data type of CV_16U or CV_16S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_16U or CV_16S.

◆ put() [17/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
short[] data,
int length )

Writes a specified number of short values to the matrix at the given row and column.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe short array containing the data elements to write.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of short values to the matrix at the provided row and column indices. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_16U or CV_16S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_16U or CV_16S.

◆ put() [18/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
short[] data,
int offset,
int length )

Writes a specified number of short values to the matrix at the given row and column, starting from the specified offset within the data array.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe short array containing the data elements to write.
offsetThe offset in the data array from which to start writing elements.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of short values to the matrix at the provided row and column indices, starting from the specified offset within the data array. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_16U or CV_16S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_16U or CV_16S.

◆ put() [19/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< byte > data )

Writes a span of byte data to the matrix at the specified row and column.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of byte data to write to the matrix.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of byte data to the matrix at the given row and column. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [20/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< byte > data,
int length )

Writes a span of byte data to the matrix at the specified row and column.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of byte data to write to the matrix.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of byte data to the matrix at the given row and column. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [21/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< byte > data,
int offset,
int length )

Writes a span of byte data to the matrix at the specified row and column, starting from the specified offset within the data span.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of byte data to write to the matrix.
offsetThe offset into the span from which to start writing data.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of byte data to the matrix at the given row and column, starting from the specified offset within the data span. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [22/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< double > data )

Writes a span of double data to the matrix at the specified row and column, casting them to match the matrix's data type.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of double data to write to the matrix.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of double data to the matrix at the given row and column. The values are automatically cast to match the matrix's data type. The number of elements written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the data array is null, or if the number of elements is not a multiple of the matrix's channel count.

◆ put() [23/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< double > data,
int length )

Writes a span of double data to the matrix at the specified row and column, casting them to match the matrix's data type.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of double data to write to the matrix.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of double data to the matrix at the given row and column The values are automatically cast to match the matrix's data type. The number of elements written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the data array is null, or if the number of elements is not a multiple of the matrix's channel count.

◆ put() [24/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< double > data,
int offset,
int length )

Writes a span of double data to the matrix at the specified row and column, starting from the specified offset within the data array, casting them to match the matrix's data type.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of double data to write to the matrix.
offsetThe offset into the span from which to start writing data.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of double data to the matrix at the given row and column, starting from the specified offset within the data span. The values are automatically cast to match the matrix's data type. The number of elements written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the data array is null, or if the number of elements is not a multiple of the matrix's channel count.

◆ put() [25/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< float > data )

Writes a span of float data to the matrix at the specified row and column.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of float data to write to the matrix.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of float data to the matrix at the given row and column. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [26/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< float > data,
int length )

Writes a span of float data to the matrix at the specified row and column.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of float data to write to the matrix.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of float data to the matrix at the given row and column. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [27/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< float > data,
int offset,
int length )

Writes a span of float data to the matrix at the specified row and column, starting from the specified offset within the data span.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of float data to write to the matrix.
offsetThe offset into the span from which to start writing data.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of float data to the matrix at the given row and column, starting from the specified offset within the data span. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [28/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< int > data )

Writes a span of int data to the matrix at the specified row and column.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of int data to write to the matrix.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of int data to the matrix at the given row and column. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [29/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< int > data,
int length )

Writes a span of int data to the matrix at the specified row and column.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of int data to write to the matrix.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of int data to the matrix at the given row and column. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [30/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< int > data,
int offset,
int length )

Writes a span of int data to the matrix at the specified row and column, starting from the specified offset within the data span.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of int data to write to the matrix.
offsetThe offset into the span from which to start writing data.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of int data to the matrix at the given row and column, starting from the specified offset within the data span. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [31/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< sbyte > data )

Writes a span of sbyte data to the matrix at the specified row and column.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of sbyte data to write to the matrix.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of sbyte data to the matrix at the given row and column. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [32/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< sbyte > data,
int length )

Writes a span of sbyte data to the matrix at the specified row and column.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of sbyte data to write to the matrix.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of sbyte data to the matrix at the given row and column. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [33/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< sbyte > data,
int offset,
int length )

Writes a span of sbyte data to the matrix at the specified row and column, starting from the specified offset within the data span.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of sbyte data to write to the matrix.
offsetThe offset into the span from which to start writing data.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of sbyte data to the matrix at the given row and column, starting from the specified offset within the data span. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [34/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< short > data )

Writes a span of short data to the matrix at the specified row and column.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of short data to write to the matrix.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of short data to the matrix at the given row and column. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [35/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< short > data,
int length )

Writes a span of short data to the matrix at the specified row and column.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of short data to write to the matrix.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of short data to the matrix at the given row and column. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [36/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< short > data,
int offset,
int length )

Writes a span of short data to the matrix at the specified row and column, starting from the specified offset within the data span.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of short data to write to the matrix.
offsetThe offset into the span from which to start writing data.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of short data to the matrix at the given row and column, starting from the specified offset within the data span. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [37/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< ushort > data )

Writes a span of ushort data to the matrix at the specified row and column.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of ushort data to write to the matrix.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of ushort data to the matrix at the given row and column. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [38/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< ushort > data,
int length )

Writes a span of ushort data to the matrix at the specified row and column.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of ushort data to write to the matrix.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of ushort data to the matrix at the given row and column. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [39/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
Span< ushort > data,
int offset,
int length )

Writes a span of ushort data to the matrix at the specified row and column, starting from the specified offset within the data span.

Parameters
rowThe row index in the matrix where the data will be written.
colThe column index in the matrix where the data will be written.
dataThe span of ushort data to write to the matrix.
offsetThe offset into the span from which to start writing data.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of ushort data to the matrix at the given row and column, starting from the specified offset within the data span. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [40/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
ushort[] data )

Writes an ushort array to the matrix at the specified row and column.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe ushort array containing the data elements to write.
Returns
The number of elements successfully written to the matrix.

This method writes the specified ushort array to the matrix at the given row and column. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_16U or CV_16S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_16U or CV_16S.

◆ put() [41/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
ushort[] data,
int length )

Writes a specified number of ushort values to the matrix at the given row and column.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe ushort array containing the data elements to write.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of ushort values to the matrix at the provided row and column indices. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_16U or CV_16S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_16U or CV_16S.

◆ put() [42/84]

int OpenCVForUnity.CoreModule.Mat.put ( int row,
int col,
ushort[] data,
int offset,
int length )

Writes a specified number of ushort values to the matrix at the given row and column, starting from the specified offset within the data array.

Parameters
rowThe row index where the data will be written.
colThe column index where the data will be written.
dataThe ushort array containing the data elements to write.
offsetThe offset in the data array from which to start writing elements.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of ushort values to the matrix at the provided row and column indices, starting from the specified offset within the data array. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_16U or CV_16S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the matrix's data type is not CV_16U or CV_16S.

◆ put() [43/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
byte[] data )

Writes a byte array to the matrix at the specified indices.

Parameters
idxAn array of indices where the data will be written.
dataThe byte array containing the data elements to write.
Returns
The number of elements successfully written to the matrix.

This method writes the specified byte array to the matrix at the given indices. The number of elements in the data array must be a multiple of the matrix's channel count. The number of indices provided in idx must match the number of dimensions of the matrix. Only matrices with a data type of CV_8U or CV_8S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices does not match the matrix's dimensions, or if the matrix's data type is not CV_8U or CV_8S.

◆ put() [44/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
byte[] data,
int length )

Writes a specified number of byte values to the matrix at the given indices.

Parameters
idxThe array of indices where the data will be written.
dataThe byte array containing the data elements to write.
lengthThe number of bytes to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of byte values to the matrix at the provided indices. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_8U or CV_8S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices does not match the matrix's dimensionality, or if the matrix's data type is not CV_8U or CV_8S.

◆ put() [45/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
byte[] data,
int offset,
int length )

Writes a specified number of byte values to the matrix at the given indices, starting from the specified offset within the data array.

Parameters
idxThe array of indices where the data will be written.
dataThe byte array containing the data elements to write.
offsetThe offset in the data array from which to start writing elements.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of byte values to the matrix at the provided indices, starting from the specified offset within the data array. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_8U or CV_8S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the number of indices is incorrect, or if the matrix's data type is not CV_8U or CV_8S.

◆ put() [46/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
double[] data,
int length )

Writes a specified number of double values to the matrix at the given indices, casting them to match the matrix's data type.

Parameters
idxAn array specifying the multi-dimensional indices where the data will be written.
dataThe double array containing the data elements to write.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of double values to the matrix at the provided indices indices. The values are automatically cast to match the matrix's data type. The number of elements written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the data array is null, or if the number of elements is not a multiple of the matrix's channel count.

◆ put() [47/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
double[] data,
int offset,
int length )

Writes a specified number of double values to the matrix at the given indices, starting from the specified offset within the data array, casting them to match the matrix's data type.

Parameters
idxAn array specifying the multi-dimensional indices where the data will be written.
dataThe double array containing the data elements to write.
offsetThe offset in the data array from which to start writing elements.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of double values to the matrix at the provided indices, starting from the specified offset within the data array. The values are automatically cast to match the matrix's data type. The number of elements written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the data array is null, or if the number of elements is not a multiple of the matrix's channel count.

◆ put() [48/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
float[] data )

Writes a float array to the matrix at the specified indices.

Parameters
idxAn array specifying the multi-dimensional indices where the data will be written.
dataThe float array containing the data elements to write.
Returns
The number of elements successfully written to the matrix.

This method writes the specified float array to the matrix at the given multi-dimensional indices. The number of elements in the data array must be a multiple of the matrix's channel count. Only matrices with a data type of CV_32F are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices in idx does not match the matrix's dimensionality, or if the matrix's data type is not CV_32F.

◆ put() [49/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
float[] data,
int length )

Writes a specified number of float values to the matrix at the given indices.

Parameters
idxThe array of indices where the data will be written.
dataThe float array containing the data elements to write.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of float values to the matrix at the provided indices. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_32F for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the number of indices is incorrect, or if the matrix's data type is not CV_32F.

◆ put() [50/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
float[] data,
int offset,
int length )

Writes a specified number of float values to the matrix at the given indices, starting from the specified offset within the data array.

Parameters
idxThe array of indices where the data will be written.
dataThe float array containing the data elements to write.
offsetThe offset in the data array from which to start writing elements.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of float values to the matrix at the provided indices, starting from the specified offset within the data array. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_32F for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the number of indices is incorrect, or if the matrix's data type is not CV_32F.

◆ put() [51/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
int[] data )

Writes an int array to the matrix at the specified indices.

Parameters
idxAn array of indices where the data will be written.
dataThe int array containing the data elements to write.
Returns
The number of elements successfully written to the matrix.

This method writes the specified int array to the matrix at the given indices. The number of elements in the data array must be a multiple of the matrix's channel count. The number of indices provided must match the number of dimensions of the matrix. Only matrices with a data type of CV_32S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices does not match the matrix's dimensions, or if the matrix's data type is not CV_32S.

◆ put() [52/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
int[] data,
int length )

Writes a specified number of int values to the matrix at the given indices.

Parameters
idxThe array of indices where the data will be written.
dataThe int array containing the data elements to write.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of int values to the matrix at the provided indices. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_32S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the number of indices is incorrect, or if the matrix's data type is not CV_32S.

◆ put() [53/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
int[] data,
int offset,
int length )

Writes a specified number of int values to the matrix at the given indices, starting from the specified offset within the data array.

Parameters
idxThe array of indices where the data will be written.
dataThe int array containing the data elements to write.
offsetThe offset in the data array from which to start writing elements.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of int values to the matrix at the provided indices, starting from the specified offset within the data array. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_32S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the number of indices is incorrect, or if the matrix's data type is not CV_32S.

◆ put() [54/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
params double[] data )

Writes a double array to the matrix at the given indices, casting them to match the matrix's data type.

Parameters
idxAn array specifying the multi-dimensional indices where the data will be written.
dataThe double array containing the data elements to write.
Returns
The number of elements successfully written to the matrix.

This method writes the specified double array to the matrix at the provided indices. The values are automatically cast to match the matrix's data type. The number of elements written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the data array is null, or if the number of elements is not a multiple of the matrix's channel count.

◆ put() [55/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
sbyte[] data )

Writes a sbyte array to the matrix at the specified multi-dimensional indices.

Parameters
idxThe array of indices specifying the position in the matrix where the data will be written.
dataThe sbyte array containing the data elements to write.
Returns
The number of elements successfully written to the matrix.

This method writes the specified array of sbyte array to the matrix at the given multi-dimensional indices. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_8U or CV_8S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of provided indices does not match the matrix's dimensions, or if the matrix's data type is not CV_8U or CV_8S.

◆ put() [56/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
sbyte[] data,
int length )

Writes a specified number of sbyte values to the matrix at the given indices.

Parameters
idxThe array of indices where the data will be written.
dataThe sbyte array containing the data elements to write.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of sbyte values to the matrix at the provided indices. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_8U or CV_8S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the number of indices is incorrect, or if the matrix's data type is not CV_8U or CV_8S.

◆ put() [57/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
sbyte[] data,
int offset,
int length )

Writes a specified number of sbyte values to the matrix at the given indices, starting from the specified offset within the data array.

Parameters
idxThe array of indices where the data will be written.
dataThe sbyte array containing the data elements to write.
offsetThe offset in the data array from which to start writing elements.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of sbyte values to the matrix at the provided indices, starting from the specified offset within the data array. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_8U or CV_8S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the number of indices is incorrect, or if the matrix's data type is not CV_8U or CV_8S.

◆ put() [58/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
short[] data )

Writes a short array to the matrix at the specified indices.

Parameters
idxAn array of indices where the data will be written.
dataThe short array containing the data elements to write.
Returns
The number of elements successfully written to the matrix.

This method writes the specified short array to the matrix at the given indices. The number of elements in the data array must be a multiple of the matrix's channel count. The number of indices provided must match the matrix's dimensions. Only matrices with a data type of CV_16U or CV_16S are compatible with this method.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, if the number of indices does not match the matrix's dimensions, or if the matrix's data type is not CV_16U or CV_16S.

◆ put() [59/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
short[] data,
int length )

Writes a specified number of short values to the matrix at the given indices.

Parameters
idxThe array of indices where the data will be written.
dataThe short array containing the data elements to write.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of short values to the matrix at the provided indices. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_16U or CV_16S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the number of indices is incorrect, or if the matrix's data type is not CV_16U or CV_16S.

◆ put() [60/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
short[] data,
int offset,
int length )

Writes a specified number of short values to the matrix at the given indices, starting from the specified offset within the data array.

Parameters
idxThe array of indices where the data will be written.
dataThe short array containing the data elements to write.
offsetThe offset in the data array from which to start writing elements.
lengthThe number of elements to write from the data array.
Returns
The number of elements successfully written to the matrix.

This method writes the specified number of short values to the matrix at the provided indices, starting from the specified offset within the data array. The number of elements written must be a multiple of the matrix's channel count. The matrix must be of type CV_16U or CV_16S for compatibility.

Exceptions
CvExceptionThrown if the data array is null, if the number of elements is not a multiple of the matrix's channel count, or if the number of indices is incorrect, or if the matrix's data type is not CV_16U or CV_16S.

◆ put() [61/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
Span< byte > data )

Writes a span of byte data to the matrix at the specified indices.

Parameters
idxThe indices in the matrix where the data will be written.
dataThe span of byte data to write to the matrix.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of byte data to the matrix at the given indices. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [62/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
Span< byte > data,
int length )

Writes a span of byte data to the matrix at the specified indices with a specified length.

Parameters
idxThe indices in the matrix where the data will be written.
dataThe span of byte data to write to the matrix.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of byte data to the matrix at the given indices. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [63/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
Span< byte > data,
int offset,
int length )

Writes a span of byte data to the matrix at the specified indices, starting from the specified offset within the data span.

Parameters
idxThe indices in the matrix where the data will be written.
dataThe span of byte data to write to the matrix.
offsetThe offset into the span from which to start writing data.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of byte data to the matrix at the given indices, starting from the specified offset within the data span. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [64/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
Span< double > data )

Writes a span of double data to the matrix at the specified indices, casting them to match the matrix's data type.

Parameters
idxThe indices in the matrix where the data will be written.
dataThe span of double data to write to the matrix.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of double data to the matrix at the given indices. The values are automatically cast to match the matrix's data type. The number of elements written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the data array is null, or if the number of elements is not a multiple of the matrix's channel count.

◆ put() [65/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
Span< double > data,
int length )

Writes a span of double data to the matrix at the specified indices with a specified length, casting them to match the matrix's data type.

Parameters
idxThe indices in the matrix where the data will be written.
dataThe span of double data to write to the matrix.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of double data to the matrix at the given indices. The values are automatically cast to match the matrix's data type. The number of elements written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the data array is null, or if the number of elements is not a multiple of the matrix's channel count.

◆ put() [66/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
Span< double > data,
int offset,
int length )

Writes a span of double data to the matrix at the specified indices, starting from the specified offset within the data span, casting them to match the matrix's data type.

Parameters
idxThe indices in the matrix where the data will be written.
dataThe span of double data to write to the matrix.
offsetThe offset into the span from which to start writing data.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of double data to the matrix at the given indices, starting from the specified offset within the data span. The values are automatically cast to match the matrix's data type. The number of elements written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the data array is null, or if the number of elements is not a multiple of the matrix's channel count.

◆ put() [67/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
Span< float > data )

Writes a span of float data to the matrix at the specified indices.

Parameters
idxThe indices in the matrix where the data will be written.
dataThe span of float data to write to the matrix.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of float data to the matrix at the given indices. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [68/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
Span< float > data,
int length )

Writes a span of float data to the matrix at the specified indices with a specified length.

Parameters
idxThe indices in the matrix where the data will be written.
dataThe span of float data to write to the matrix.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of float data to the matrix at the given indices. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [69/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
Span< float > data,
int offset,
int length )

Writes a span of float data to the matrix at the specified indices, starting from the specified offset within the data span.

Parameters
idxThe indices in the matrix where the data will be written.
dataThe span of float data to write to the matrix.
offsetThe offset into the span from which to start writing data.
lengthThe number of elements to write from the span.
Returns
The number of elements successfully written to the matrix.

This method writes the specified span of float data to the matrix at the given indices, starting from the specified offset within the data span. The length of the span written must be a multiple of the matrix's channel count.

Exceptions
CvExceptionThrown if the matrix is disposed or if the length of the provided span is not a multiple of the matrix's channel count, or if the matrix's data type is not compatible.

◆ put() [70/84]

int OpenCVForUnity.CoreModule.Mat.put ( int[] idx,
Span< int >