C++ to python, numpy-OpenCv
How can i convert this line into python code
Mat out = Mat::ones(src.rows+maxYOffset, src.cols+maxXOffset, src.type());
i have tried using np.zeros() and np.ones.
How can i convert this line into python code
Mat out = Mat::ones(src.rows+maxYOffset, src.cols+maxXOffset, src.type());
i have tried using np.zeros() and np.ones.
step 1: use the builtin help:
>>> help(np.ones)
step 2: it needs a shape and a type here, so something like:
a = np.ones((h,w,c),np.uint8)
caveat: with multi-channel (c>1) Mat's opencv will only fill the 1st channel with 1, the others are left at 0 (to be compliant with complex data), while numpy will fill all of them with 1
Asked: 2018-10-23 03:22:54 -0600
Seen: 1,025 times
Last updated: Oct 23 '18
cv2 bindings incompatible with numpy.dstack function?
Initialize numpy array (cv2 python) and PerspectiveTransform
cv2.split() doesn't work beyond 512
numpy.ndarray returning incorrect pixel value vs pixelaccess type
supported input types for matchShapes
how to find glcm of an image in OpenCV or numpy?
how to append list's element to an array - python opencv
Apply transformation matrix to pixels in OpenCV image
overview needed for opencv setup on windows using eclipse
What is the dimension of the array representing a BGR image ?
and the problem is ?
also, please do NOT delete your previous questions, and ask a new one.
it does not solve the "duplicate question" problem, as you're deleteing previous comments / answers, too.
I saw [Deleted], so i del it.
The error i get
leave anything as is now, but take the advice for future posts, please.
Will do that.
and how do you get to that error ?
https://pastebin.com/d6EC2rQD
Line 43