In [1]:
#%matplotlib inline

from skimage import data, io, filter
from PIL import Image

#fname = '66048_445402766775_10599076775_5951807_3013565_n-beauty.jpg'
#fname='../kaggle/input/images/324.jpg'
#fname='aya-ueto-00460095.jpg'
#im = Image.open(fname)
im = data.coins()
edges = filter.sobel(im)
io.imshow(edges)
io.show()



ImportErrorTraceback (most recent call last)
<ipython-input-1-d10818a2fd9a> in <module>()
      1 #%matplotlib inline
      2 
----> 3 from skimage import data, io, filter
      4 from PIL import Image
      5 

ImportError: No module named skimage

In [11]:
from PIL import Image
import numpy as np
#image = Image.open('aya-ueto-00460095.jpg')
#image = Image.open('Screenshot_2016-10-19-23-50-10.png')
image = Image.open('317_2.jpg')
image


Out[11]:

In [12]:
im = image.convert('L')
im


Out[12]:

In [14]:
np.array(im)


Out[14]:
array([[255, 255, 255, ..., 255, 255, 255],
       [255, 255, 255, ..., 255, 255, 255],
       [255, 255, 255, ..., 255, 255, 255],
       ..., 
       [255, 255, 255, ..., 255, 255, 255],
       [255, 255, 255, ..., 255, 255, 255],
       [255, 255, 255, ..., 255, 255, 255]], dtype=uint8)

In [17]:
from pylab import *
figure()
gray()
contour (im, origin='image')
axis('equal')
axis('off')
figure()
hist(im.flatten(),128)
show()



AttributeErrorTraceback (most recent call last)
<ipython-input-17-398a89eff17e> in <module>()
      6 axis('off')
      7 figure()
----> 8 hist(im.flatten(),128)
      9 show()

AttributeError: 'Image' object has no attribute 'flatten'
<matplotlib.figure.Figure at 0x7f1be85da590>

In [ ]: