reshape method

Mat reshape(
  1. int cn, [
  2. int rows = 0
])

Changes the shape and/or the number of channels of a 2D matrix without copying the data.

The method makes a new matrix header for *this elements. The new matrix may have a different size and/or different number of channels. Any combination is possible if:

  • No extra elements are included into the new matrix and no elements are excluded. Consequently, the product rowscolschannels() must stay the same after the transformation.
  • No data is copied. That is, this is an O(1) operation. Consequently, if you change the number of rows, or the operation changes the indices of elements row in some other way, the matrix must be continuous. See Mat::isContinuous .

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

Implementation

Mat reshape(int cn, [int rows = 0]) {
  final p = calloc<ccore.Mat>();
  cvRun(() => ccore.Mat_Reshape(ref, cn, rows, p));
  final dst = Mat._(p);
  return dst;
}