So, this is what I am trying:
import cv2
import cv2.cv as cv
cv2.namedWindow(threeDWinName, cv2.CV_WINDOW_AUTOSIZE)
img2 = cv.CreateImage((320, 240), 32, 1)
cv2.imshow(threeDWinName,img2)
Does anybody know what is going wrong with this? I get TypeError: <unknown> is not a numpy array
Thanks
The more recent version of OpenCV,
cv2uses numpy arrays for images, the preceding versioncvused opencv’s special Mat’s. In your code you’ve created an image as aMatusing the oldcvfunctionCreateImage, and then tried to view it using the newercv2.imshowfunction, butcv2.imshowexpects a numpy array……so all you need to do is import numpy, and then change you
CreateImageline to:And then it should be fine 🙂