reshape method
creates alternative matrix header for the same data, with different number of channels and/or different number of rows. see cvReshape.
UMat reshape(int cn, int rows=0) const;
UMat reshape(int cn, int newndims, const int* newsz) const;
https://docs.opencv.org/4.x/d7/d45/classcv_1_1UMat.html#a25ac687266568c8b024debd187c15b9b
Implementation
UMat reshape(int cn, {int? rows, List<int>? newSizes}) {
final p = calloc<cvg.UMat>();
if (newSizes == null) {
cvRun(() => ccore.cv_UMat_reshape(ref, cn, rows ?? 0, p, ffi.nullptr));
} else {
final cNewSizes = calloc<ffi.Int>(newSizes.length);
cNewSizes.cast<ffi.Int32>().asTypedList(newSizes.length).setAll(0, newSizes);
cvRun(() => ccore.cv_UMat_reshape_2(ref, cn, newSizes.length, cNewSizes, p, ffi.nullptr));
calloc.free(cNewSizes);
}
return UMat._(p);
}