UMat.create constructor

UMat.create({
  1. int rows = 0,
  2. int cols = 0,
  3. int r = 0,
  4. int g = 0,
  5. int b = 0,
  6. MatType? type,
  7. UMatUsageFlags flags = UMatUsageFlags.USAGE_DEFAULT,
})

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

UMat(int rows, int cols, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
UMat(int rows, int cols, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT);

https://docs.opencv.org/4.x/d7/d45/classcv_1_1UMat.html#a5e1866c206e9c116304a0257bc3a6c50

Implementation

factory UMat.create({
  int rows = 0,
  int cols = 0,
  int r = 0,
  int g = 0,
  int b = 0,
  MatType? type,
  UMatUsageFlags flags = UMatUsageFlags.USAGE_DEFAULT,
}) {
  if (rows == 0 && cols == 0) {
    return UMat.empty(flags: flags);
  }

  type = type ?? MatType.CV_8UC3;
  final scalar = Scalar(b.toDouble(), g.toDouble(), r.toDouble(), 0);
  final p = calloc<cvg.UMat>();
  cvRun(() => ccore.cv_UMat_create_3(rows, cols, type!.value, scalar.ref, flags.value, p));
  return UMat._(p);
}