【发布时间】:2017-01-16 23:36:09
【问题描述】:
如何将字节数组转换为 Python 中的 Mat 对象。
import numpy as np
mat = np.asarray(0, 0, data)
print 'Cols n Row ' + str(mat.cols) + " " + str(mat.rows)
但它不起作用。有人可以帮忙吗?
【问题讨论】:
-
您收到错误消息还是什么?
data是什么?你期待什么结果? -
data是字节数组,我想将其转换为OpenCV Mat。我没有得到任何输出。这是错误TypeError: data type not understood -
您应该使用
cv2.imdecode,如以下答案stackoverflow.com/questions/17170752/…中所述