How do I convert a byte array to Mat object in Python
.
import numpy as np
mat = np.asarray(0, 0, data)
print 'Cols n Row ' + str(mat.cols) + " " + str(mat.rows)
But it is not working. Can some one help.
How do I convert a byte array to Mat object in Python
.
import numpy as np
mat = np.asarray(0, 0, data)
print 'Cols n Row ' + str(mat.cols) + " " + str(mat.rows)
But it is not working. Can some one help.
What about giving it a try like this? Probably you need to define the data type of the matrix, else it is not obvious how to divide the byte array into 'chunks' that will be stored in one cell.
mat = np.asarray(data, dtype=np.uint8)
print 'Cols n Row ' + str(mat.shape[1]) + " " + str(mat.shape[0])