Python Skimage:如何显示图像
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38606372/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Skimage: how to show image
提问by Tehada
I am novice at skimage and I try to show the image in my ipython notebook:\
我是 skimage 的新手,我尝试在我的 ipython 笔记本中显示图像:\
from skimage import data, io
coins = data.coins()
io.imshow(coins)
But I see only the following string:
但我只看到以下字符串:
<matplotlib.image.AxesImage at 0x7f8c9c0cc6d8>
Can anyboby explain how to show image right under the code like here: Correct output
任何人都可以解释如何在代码下显示图像,如下所示: 正确的输出
回答by Eli Korvigo
Just add matplotlib.pyplot.show()
after the io.imshow(coins)
line.
只需matplotlib.pyplot.show()
在该io.imshow(coins)
行后添加。
from skimage import data, io
from matplotlib import pyplot as plt
coins = data.coins()
io.imshow(coins)
plt.show()
回答by BugKiller
To display pending images, you need io.show()
following io.imshow(coins)
要显示待处理的图像,您需要io.show()
以下io.imshow(coins)
回答by harikesh jaiswal
images using skikit-image,matplotlib,SciPy,NumPy library
使用skikit-image,matplotlib,SciPy,NumPy 库的图像
import os
# importing io from skimage
import skimage
from skimage import io
# way to load image from file
file = os.path.join(skimage.data_dir, 'E:/img.jpg')
myimg = io.imread(file)
# way to show the input image
io.imshow(myimg)
io.show()
回答by omphemetse
You can use skimage and matplotlib.pyplot as follows
您可以使用 skimage 和 matplotlib.pyplot 如下
from skimage import io, data
from matplotlib import pyplot as plt
# get coin image
coin = data.coins()
# display image
plt.imshow(coin)