convertTo method

Mat convertTo(
  1. MatType type, {
  2. bool inplace = false,
  3. double alpha = 1,
  4. 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, {bool inplace = false, double alpha = 1, double beta = 0}) {
  final dst = inplace ? this : Mat.empty();
  cvRun(() => ccore.cv_Mat_convertTo_1(ref, dst.ref, type.value, alpha, beta, ffi.nullptr));
  return dst;
}