Ask Your Question
0

Error in simple code

asked 2012-11-16 12:54:42 -0500

tooold gravatar image

I just installed SimpleCV on my RaspberryPi (hopefully correct) but I just can't get this simple code (copied from the Example Codes) to run!

from SimpleCV import *
cam = Camera()

while (1):
        i = cam.getImage()
        i.show()

Error:

VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
ERROR: 
Traceback (most recent call last):
  File "Webcamblob/test.py", line 6, in <module>
    i.show()
  File "/usr/local/lib/python2.7/dist-packages/SimpleCV/ImageClass.py", line 5684, in show
    d = Display(self.size())
  File "/usr/local/lib/python2.7/dist-packages/SimpleCV/Display.py", line 157, in __init__
    self.screen = pg.display.set_mode(resolution, flags)
error: Unable to open a console terminal
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
  File "/usr/local/lib/python2.7/dist-packages/SimpleCV/Camera.py", line 26, in run
<type 'exceptions.TypeError'>: 'NoneType' object is not iterable

I hope anyone can help me, i do not know what to do anymore.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-11-17 20:17:30 -0500

marco619 gravatar image

I think the code bellow is wrong.

from SimpleCV import *
cam = Camera()

while (1):
        i = cam.getImage()

        ## You will use the Image.show() function only for show a picture store in your local disk o a remote URL ##

        ##then, the following code will not run ##
        i.show()

To fix it, Do the following:

from SimpleCV import Camera, Display, Image

cam = Camera()
disp = Display()

while( disp.isNotDone() ):

 img = cam.getImage()

 img.save( display ) # This show the current frame in the Display.

I hope this useful.

edit flag offensive delete link more

Comments

Thanks for the snippet, but shouldn't the last line be: img.save( disp )

rpilkey gravatar imagerpilkey ( 2013-09-14 09:29:36 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-11-16 12:54:42 -0500

Seen: 1,181 times

Last updated: Nov 17 '12