Mat.fromScalar constructor

Mat.fromScalar(
  1. int rows,
  2. int cols,
  3. MatType type,
  4. Scalar s,
)

rows Number of rows in a 2D array.

cols Number of columns in a 2D array.

type Array 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.

s An optional value to initialize each matrix element with.

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

Implementation

factory Mat.fromScalar(int rows, int cols, MatType type, Scalar s) {
  final p = calloc<cvg.Mat>();
  cvRun(() => cffi.Mat_NewFromScalar(s.ref, rows, cols, type.value, p));
  final mat = Mat._(p);
  return mat;
}