divide<T> method

Mat divide<T>(
  1. T val, {
  2. bool inplace = false,
})

divide

Implementation

Mat divide<T>(T val, {bool inplace = false}) {
  return switch (val) {
    Mat() => divideMat(val as Mat, inplace: inplace),
    int() => switch (type.depth) {
        MatType.CV_8U => divideU8(val as int, inplace: inplace),
        MatType.CV_8S => divideI8(val as int, inplace: inplace),
        MatType.CV_16U => divideU16(val as int, inplace: inplace),
        MatType.CV_16S => divideI16(val as int, inplace: inplace),
        MatType.CV_32S => divideI32(val as int, inplace: inplace),
        _ => throw UnsupportedError("divide int to ${type.asString()} is not supported!"),
      },
    double() => switch (type.depth) {
        MatType.CV_32F => divideF32(val as double, inplace: inplace),
        MatType.CV_64F => divideF64(val as double, inplace: inplace),
        // MatType.CV_16F => divideF16(val as double, inplace: inplace), // TODO
        _ => throw UnsupportedError("divide double to ${type.asString()} is not supported!"),
      },
    _ => throw UnsupportedError("Type $T is not supported"),
  };
}