setTo method

Mat setTo(
  1. Scalar value, {
  2. Mat? mask,
})

Sets all or some of the array elements to the specified value.

This is an advanced variant of the Mat::operator=(const Scalar& s) operator.

value Assigned scalar converted to the actual array type. mask Operation 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

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

Implementation

Mat setTo(Scalar value, {Mat? mask}) {
  mask ??= Mat.empty();
  cvRun(() => ccore.cv_Mat_setTo(ref, value.ref, mask!.ref, ffi.nullptr));
  return this;
}