How to display an image with Pylab from a script in a non blocking way

I am writing some iterative image processing algorithm in a script (I don't want to be using iPython), and I would like to visualize the image I generate after each iteration. That's very easy to do in Matlab, without blocking the main thread, but I am struggling to do it in Python.

In pylab the show() function is blocking and I need to close the window to continue the execution of my script. I have seen that some people use the ion() function, but it has no effect in my case, for example:

pylab.ion()
img = pylab.imread('image.png')
pylab.imshow(img)
pylab.show()

is still blocking. I also saw people saying that "using draw instead of plot" can solve this. However, I am not using plot but imshow/show, is there something that I am missing here?

On the other hand, the PIL also has some display functions, but it seems to generate a temporary image and then display it with imagemagick, so I assume there is no way here to display an image and update it in the same window with this method.

I am using Ubuntu 10.10.

Does anyone know how to do it simply, or do I have to start using something like Qt to have a minimal GUI that I can update easily?

6
задан Greystache 5 May 2011 в 11:10
поделиться