使用 python3 相当于 OpenCV2 中的 cvCreateMat 函数

What is equivalent of cvCreateMat function in OpenCV2 using python3

我正在将用 c/cpp 编写的一段旧代码转换为 python。它使用 cvCreateMat 函数。来自 this link 我认为 OpenCV2 不支持 cvCreateMat 函数。我不知道如何使用 OpenCV2/numpy 来做到这一点。或者我所需要的只是 python 中的以下行的等价物。

cv::Mat a = cvCreateMat(3*numberOfMatrices, 6,CV_64FC1);

我觉得应该这样

// the third 3 is so it has 3 dimensions which i suppose what you need
size = 3*numberOfMatrices, 6
img = np.zeros(size, dtype=np.float64)

这是创建的正确格式