set<T> method

void set<T>(
  1. int i0,
  2. int i1,
  3. T val, [
  4. int? i2,
])

equivalent to Mat::at<T>(i0, i1, i2) = val; where T might be int, double, or cv::Vec<> like cv::Vec3b

example

var m = cv.Mat.fromScalar(cv.Scalar(2, 4, 1, 0), cv.MatType.CV_32FC3);
m.at<cv.Vec3f>(0, 0); // cv.Vec3f(2, 4, 1)
m.set<cv.Vec3f>(0, 0, cv.Vec3f(9, 9, 9));
m.at<cv.Vec3f>(0, 0); // cv.Vec3f(9, 9, 9)

Implementation

void set<T>(int i0, int i1, T val, [int? i2]) {
  switch (val) {
    case num():
      setNum(i0, i1, val, i2);
    case CvVec():
      setVec<CvVec>(i0, i1, val);
    default:
      throw UnsupportedError("Unsupported type ${val.runtimeType}");
  }
}