30

I am novice at skimage and I try to show the image in my ipython notebook:\

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

Tehada
  • 491
  • 1
  • 6
  • 11

6 Answers6

47

Just add matplotlib.pyplot.show() after the io.imshow(coins) line.

from skimage import data, io
from matplotlib import pyplot as plt


coins = data.coins()
io.imshow(coins)
plt.show()
Eli Korvigo
  • 10,265
  • 6
  • 47
  • 73
10

images using skikit-image,matplotlib,SciPy,NumPy library

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()
9

To display pending images, you need io.show() following io.imshow(coins)

BugKiller
  • 1,470
  • 1
  • 13
  • 22
4

You can use skimage and matplotlib.pyplot as follows

from skimage import io, data  
from matplotlib import pyplot as plt

# get coin image
coin = data.coins()    

# display image   
plt.imshow(coin)
plt.show() 
Ajay B
  • 746
  • 9
  • 19
Omphemetse
  • 49
  • 5
1

Just use matplotlib.pyplot.imshow() instead of io.imshow(coins).

from skimage import data.0
from matplotlib import pyplot as plt

coins = data.coins()
plt.imshow(coins)
Flair
  • 2,609
  • 1
  • 29
  • 41
1
import skimage
from skimage import io

img = io.imread('img.jpg')
io.imshow(img)
io.show()