Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将 2D 转换cvMat为 1D?我尝试将 2D 转换cvMat为 Numpy 数组,然后使用ravel()(我想要那种结果矩阵)。当我尝试将其转换回 cvMat使用cv.fromarray()它时,会出现矩阵必须是 2D 或 3D 的错误。
cvMat
ravel()
cv.fromarray()
用于在转换之前matrix.reshape((-1, 1))将n元素 1D 矩阵转换为n ×1 2D 矩阵。
matrix.reshape((-1, 1))