简体   繁体   中英

Python: displaying an image as a background process?

I am using scikit-image, and the following shows what I'm doing, in an ipython console:

import skimage.io as io
import skimage.viewer.viewers.core as sv
im = io.imread('image.jpg')
sv.ImageViewer(im).show()

This works well, except that the viewer runs as a foreground process, which means that I can't access the ipython shell until I've closed the viewing window. I like this viewer; for a grayscale image at least, the cursor shows the gray level and the indices of the current pixel. But I would like to be able to both display the image, and to continue work in the console. How can I best do this?

Worked it out! Just need to do it in two stages (as per the documentation); first

from skimage.viewer import ImageViewer

and then

fs = ImageViewer(f)
fs.show()

This works fine (except for a blank figure window which is created with the ImageViewer command).

尝试通过以下方式启动IPython:

ipython --gui=qt4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM