toList method
This method converts a Mat to a 2D list.
For single-channel Mats the shape is [rows][cols]. For multi-channel Mats
each row is flattened to cols * channels values.
When copy is true (default), the returned lists are ordinary Dart lists
(deep copy) and are safe to use after this Mat is disposed. When copy is
false, each row is a zero-copy view over the Mat's native memory: writing
to a row writes back to the Mat, and the view becomes invalid once the
Mat is disposed or its buffer is reallocated.
Implementation
List<List<num>> toList({bool copy = true}) {
final ret = <List<num>>[];
forEachRow((r, v) => ret.add(copy ? v.toList() : v));
return ret;
}