Ask Your Question

imshow in python

asked 2012-12-21 23:02:58 -0600

maldridge gravatar image

I am having immense trouble getting a program I wrote with cv to work with cv2. This is a simple webcam viewer that grabs camera 0 and displays the incoming frames to the user. I have the versions of python and opencv that are in the repo's and available by typing apt-get install python python-opencv.

I consistently get this error: TypeError: <unknown> is not a numpy array

Here is the code that causes that error:

#!/usr/bin/env python

import cv2

frame =
grey = frame

while True:
    frame =
    cv2.imshow("image", frame)

Any help is appreciated, I eagerly await suggestions.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-12-22 08:04:24 -0600

AMP gravatar image

Out put of is a bool and an image you should separate them ; and you should use waitKey.

import cv2
while True:
    cv2.imshow("image", frame)
edit flag offensive delete link more


Thank you for this answer, it works now. Although I must say, that isn't very clear in the online help pages.

maldridge gravatar imagemaldridge ( 2012-12-22 10:53:23 -0600 )edit

Question Tools


Asked: 2012-12-21 23:02:58 -0600

Seen: 3,091 times

Last updated: Dec 22 '12