Ask Your Question

Why freezes?

asked 2013-02-23 09:04:03 -0500

anonymous user


updated 2013-02-23 09:05:07 -0500

Hi I installed current git version on 32 bit Windows under Python 2.7, without issues.

Module works as expected, but every time I instruct is freezes and it crashes underline shell after I force it to terminate. For example:

from SimpleCV import Image
img = Image("test.png")

Why is this, or how can I convert img to numpy array, so that I can see it with matplotlib?

edit retag flag offensive close merge delete

6 Answers

Sort by ยป oldest newest most voted

answered 2013-03-03 18:17:45 -0500

Bryce Fricke gravatar image

I've had issues similar to what you're describing. While I'm not sure what the root cause is, I have found a way to at least close the window without terminating Python. the routine returns the window that was created. Calling the quit() method on the window will close it without error. Modified like this, your original example would be:

from SimpleCV import Image
img = Image("test.png")
win =

#wait for user input before closing

I hope this helps.

edit flag offensive delete link more

answered 2013-02-25 09:04:43 -0500

kscottz gravatar image


Sorry you are having problems. PyGame is a little flakey and we are going to move away from it in the upcoming releases (we were discussing this at this morning's stand-up actually). Once you create a display object it should stay open until you kill your python session or actually close the display. Just because of how PyGame behaves the display will remain open and you can't close it. Can you confirm this is the behavior vs an outright freeze? If you run a while loop does the display still freeze?

edit flag offensive delete link more

answered 2013-02-25 16:42:16 -0500

zed gravatar image

updated 2013-02-25 16:45:01 -0500

Thanks @kscottz, I can't find how to comment your answer so I'll use this box instead.

Window pops on and CPU is constantly high while this window is active, indicating a bad loop somewhere. If I try to close the window it just looks like freezed inaccessible window and I need to terminate python process that started the script as a way out.

I don't understand your while loop suggestion. Can you provide sample code? I tried to capture keypress with msvcrt.kbhit() but it seems like this image window is blocking it, the same as trying to to use KeyboardInterrupt Exception.

edit flag offensive delete link more

answered 2014-12-29 12:51:07 -0500

danielgoodrick gravatar image

try adding waitKey() after your show() command

edit flag offensive delete link more

answered 2013-03-04 19:40:25 -0500

victsou gravatar image

updated 2013-03-04 19:43:44 -0500

Doing the obvious thing to close a PyGame window (clicking the X) can't and doesn't work with SimpleCV displays.

What this deceiving button does is send PyGame a QUIT event, usually caught from PyGame's event queue in a loop. As we don't want the console to hang in a loop when displaying an image, we don't try to catch it and can't really do anything except hope that the user closes the window with window.quit()! ( returns a Display object, which has a quit command)

edit flag offensive delete link more

answered 2013-04-08 09:33:49 -0500

machine_eye gravatar image

@kscottz The display in while loop works completely fine in both windows 7 64 bit(installed using superPack) and ubuntu 12.10.I have tested

edit flag offensive delete link more



Problem solved.Use if you want to exit it dont use close button.Type Display().quit() on cmd line.It will work Fine.

machine_eye gravatar imagemachine_eye ( 2013-04-08 09:52:33 -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


Asked: 2013-02-23 09:04:03 -0500

Seen: 10,694 times

Last updated: Dec 29 '14