Method FromPixelData
- Namespace
- OpenCvSharp
- Assembly
- OpenCvSharp.dll
FromPixelData(int, int, nint, long)
constructor for matrix headers pointing to user-allocated data
public static Mat<TElem> FromPixelData(int rows, int cols, nint data, long step = 0)
Parameters
rowsintNumber of rows in a 2D array.
colsintNumber of columns in a 2D array.
datanintPointer 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 de-allocated, so you should take care of it.
steplongNumber 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() .
Returns
- Mat<TElem>
FromPixelData(int, int, Array, long)
constructor for matrix headers pointing to user-allocated data
public static Mat<TElem> FromPixelData(int rows, int cols, Array data, long step = 0)
Parameters
rowsintNumber of rows in a 2D array.
colsintNumber of columns in a 2D array.
dataArrayPointer 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 de-allocated, so you should take care of it.
steplongNumber 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() .
Returns
- Mat<TElem>
FromPixelData(IEnumerable<int>, nint, IEnumerable<long>?)
constructor for matrix headers pointing to user-allocated data
public static Mat<TElem> FromPixelData(IEnumerable<int> sizes, nint data, IEnumerable<long>? steps = null)
Parameters
sizesIEnumerable<int>Array of integers specifying an n-dimensional array shape.
datanintPointer 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 de-allocated, so you should take care of it.
stepsIEnumerable<long>Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). If not specified, the matrix is assumed to be continuous.
Returns
- Mat<TElem>