简体   繁体   English

什么等效于使用python3的OpenCV2中的cvCreateMat函数

[英]What is equivalent of cvCreateMat function in OpenCV2 using python3

I am converting an old piece of code written in c/cpp into python. 我正在将用c / cpp编写的旧代码转换为python。 It uses cvCreateMat function. 它使用cvCreateMat函数。 From this link I believe that cvCreateMat function is not supported in OpenCV2. 通过此链接,我相信OpenCV2不支持cvCreateMat函数。 I dont know how to do it using OpenCV2/numpy. 我不知道如何使用OpenCV2 / numpy。 OR all I need is the equivalent of the following line in python. 或者我所需要的就是python中以下行的等效项。

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

I think this should do 我认为这应该做

// 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)

this is the correct format to create 这是要创建的正确格式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM