convertTo method

Mat convertTo(
  1. MatType type, {
  2. double alpha = 1,
  3. double beta = 0,
})

Converts an array to another data type with optional scaling.

The method converts source pixel values to the target data type. saturate_cast<> is applied at the end to avoid possible overflows:

$m(x,y) = saturate _ cast

Parameters type desired output matrix type or, rather, the depth since the number of channels are the same as the input has; if rtype is negative, the output matrix will have the same type as the input. alpha optional scale factor. beta optional delta added to the scaled values.

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

Implementation

Mat convertTo(MatType type, {double alpha = 1, double beta = 0}) {
  final dst = Mat.empty();
  cvRun(() => ccore.Mat_ConvertToWithParams(ref, dst.ref, type.value, alpha, beta));
  return dst;
}