Mat.zeros constructor

Mat.zeros(
  1. int rows,
  2. int cols,
  3. MatType type
)

Returns a zero array of the specified size and type.

The method returns a Matlab-style zero array initializer. It can be used to quickly form a constant array as a function parameter, part of a matrix expression, or as a matrix initializer:

Mat A;
A = Mat::zeros(3, 3, CV_32F);

In the example above, a new matrix is allocated only if A is not a 3x3 floating-point matrix. Otherwise, the existing matrix A is filled with zeros.

rows Number of rows.

cols Number of columns.

type Created matrix type.

https://docs.opencv.org/4.x/d3/d63/classcv_1_1Mat.html#a56daa006391a670e9cb0cd08e3168c99

Implementation

factory Mat.zeros(int rows, int cols, MatType type) {
  final p = calloc<ccore.Mat>();
  cvRun(() => ccore.Zeros(rows, cols, type.value, p));
  final mat = Mat._(p);
  return mat;
}