add<T> method
add
Implementation
Mat add<T>(T val, {bool inplace = false}) {
return switch (val) {
Mat() => addMat(val as Mat, inplace: inplace),
int() => switch (type.depth) {
MatType.CV_8U => addU8(val as int, inplace: inplace),
MatType.CV_8S => addI8(val as int, inplace: inplace),
MatType.CV_16U => addU16(val as int, inplace: inplace),
MatType.CV_16S => addI16(val as int, inplace: inplace),
MatType.CV_32S => addI32(val as int, inplace: inplace),
_ => throw UnsupportedError("add int to ${type.asString()} is not supported!"),
},
double() => switch (type.depth) {
MatType.CV_32F => addF32(val as double, inplace: inplace),
MatType.CV_64F => addF64(val as double, inplace: inplace),
// MatType.CV_16F => addF16(val as double, inplace: inplace), // TODO
_ => throw UnsupportedError("add double to ${type.asString()} is not supported!"),
},
_ => throw UnsupportedError("Type $T is not supported"),
};
}