Change multi-dimensional array in Mat to one-dimensional array.
Greatly reduce the memory usage of Hitmap.