I'm new to python and I don't know how to create numpy array that may be used in opencv functions. I've got two vectors defined as follows:
X=np.array(x_list)
Y=np.array(y_list)
and the result is:
[ 250.78 250.23 249.67 ..., 251.89 251.34 250.78]
[ 251.89 251.89 252.45 ..., 248.56 248.56 251.89]
I want to create opencv contour to be used in ex. cv2.contourArea(contour). I read Checking contour area in opencv using python but cannot write my contour numpy array properly. What's the best way to do that?
contour.shapeyou'll be able to work out it's dimensions. If you want to write a compatible numpy array it will need to have 3 dimensions. For examplenumpy.zeros(1,2,3)will create a 3D array of zeros of shape 1x2x3... Try testing that out!