简体   繁体   中英

What is equivalent of cvCreateMat function in OpenCV2 using python3

I am converting an old piece of code written in c/cpp into python. It uses cvCreateMat function. From this link I believe that cvCreateMat function is not supported in OpenCV2. I dont know how to do it using OpenCV2/numpy. OR all I need is the equivalent of the following line in 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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