Error when trying to draw line or rectangle

asked 2014-04-19 17:04:23 -0500

ss32 gravatar image

updated 2014-04-19 17:06:05 -0500

I'm getting an error when trying to run the following code and have no idea why. This is essentially the exact same code that's used in the tutorials.

The error:

Traceback (most recent call last):
  File "", line 41, in <module>
cv2.error: /build/buildd/opencv-2.4.5+dfsg/modules/core/src/array.cpp:2482: error: (-206)     Unrecognized or unsupported array type in function cvGetMat

And the code:

import cv2
import numpy as np

# Create a black image
img = np.zeros((512,512,3), np.uint8)

# Draw a green rectangle
img = cv2.rectangle(img,(384,0),(510,128),(0,255,0),3)

while (True):

    k = cv2.waitKey(1) & 0xFF
    if k == 27:
edit retag flag offensive close merge delete