Ask Your Question

What is equivalent of cvCreateMat function in OpenCV2 using python3

asked 2019-02-15 05:25:49 -0500

I am converting an old piece of code written in c/cpp into python. It uses cvCreateMat function. 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 have seen the link but I cant get it in my case.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-02-15 05:34:50 -0500

berak gravatar image

updated 2019-02-15 05:35:28 -0500

there is no such thing. cv2 is using numpy arrays all the way down.

and please, throw away any c-based opencv code immediately, it'll be more a hindrance, than helpful.

please take a good look at the python docs

edit flag offensive delete link more



Okay, is this equivalent to above code img = np.zeros((3*numberOfMatrices, 6), dtype=np.float64)

mianasbat gravatar imagemianasbat ( 2019-02-15 05:39:55 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-02-15 05:25:49 -0500

Seen: 66 times

Last updated: Feb 15