Ask Your Question
0

camera troubleshooting on Windows

asked 2013-08-12 10:27:39 -0500

KevinH gravatar image

updated 2013-08-12 11:07:12 -0500

Hey, I'm trying to get started with SimpleCV on Windows 7 and having some issues. I have a logitech camera that works fine for skype, etc, but I can't seem to get the simple 'hellow world' simpleCV script working:

from SimpleCV import *
cam = Camera()
#at this point the camera light turns on
img = cam.getImage()
print img
<SimpleCV.Image Object size:(640, 480), filename: (None), at memory location: (0x3d000d0)>
img.show()
# here the program will freeze, and the camera light will turn off only after force quitting.

EDIT: However, it looks like the .live() method works just fine, I get a window with a live image of the webcam. That's great I guess, but I'd still love to be able to capture single images and follow along with the tutorials.

EDIT#2: Okay, this gets even weirder. So I just went into .live() and tried to recreate a little short segment of that code to get something that was working. It uses the img.save(disp) mechanic instead of show, BUT when I try that in my own script, that display freezes.

from SimpleCV import Camera, Display
import time

cam = Camera()

start_time = time.time()

i = cam.getImage()
d = Display(i.size())
#already this new new window says 'Not Responding', BUT it can be .quit().... ?
i.save(d)
print 'First Draw'

while time.time() < start_time+10:

    print 'Another Draw'
    #this print gets called repeatedly, so we are at least making it through the loop.
    i = cam.getImage()
    i.save(d)

d.quit()

Seriously weird.

EDIT #3(last one I swear): I was using Python-x,y to run the program through an interactive console (including the .live() that worked), so I figured I'd try just a good old cmd just in case. That results is an all black Display window, that doesn't say 'Not Responding', but still shows no images for the whole 10 sec... Something very odd is going on....

edit retag flag offensive close merge delete

Comments

Did you try running the whole thing as a .py file? It works for me. Also, about the "not responding" issue, actually the .live() takes control of the program and you cant really run another command unless you close the window. show() however is a one-off thing. it shows the window just once.

bendtherules gravatar imagebendtherules ( 2013-08-13 09:26:46 -0500 )edit

Ah, yes, with my extensive edits I maybe wasn't clear. That's what i meant by 'good old cmd'. I ran 'python simpleCV_test.py' from the command line. Regardless, in the interactive console .live() works but .show() and img.save(disp) do not.... which they should yes?

KevinH gravatar imageKevinH ( 2013-08-13 15:11:07 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-08-22 09:01:37 -0500

xamox gravatar image

I believe this is actually an issue with pygame on windows. I'm not sure if it's because the display is not threaded or not. A work around, while not the nicest, is to use the JpegStreamer and a web browser.

To do this run the follow:

from SimpleCV import Camera, JpegStreamer
cam = Camera()
js = JpegStreamer()

while True:
  img = cam.getImage()
  img.save(js)

Then open your web browser to: http://localhost:8080

And you should have a live view.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-08-12 10:27:39 -0500

Seen: 880 times

Last updated: Aug 22 '14