In [1]:
import numpy as np

In [3]:
#(np.random.rand(10,5)*10).astype(int)


Out[3]:
array([[5, 8, 7, 3, 2],
       [3, 8, 8, 1, 3],
       [5, 8, 0, 7, 6],
       [0, 4, 1, 3, 2],
       [0, 9, 8, 6, 8],
       [8, 8, 5, 2, 6],
       [1, 3, 3, 6, 2],
       [3, 3, 5, 0, 4],
       [5, 2, 5, 7, 8],
       [9, 6, 8, 2, 5]])

In [4]:
from PIL import Image

In [10]:
fimg = Image.open('../data/cameraman.tif')
fimg


Out[10]:

In [11]:
np.array(fimg)


Out[11]:
array([[169, 168, 174, ..., 194, 191, 193],
       [174, 175, 176, ..., 188, 186, 186],
       [171, 178, 172, ..., 195, 188, 191],
       ..., 
       [178, 183, 183, ..., 144, 186, 174],
       [187, 180, 157, ..., 148, 183, 152],
       [169, 170, 160, ..., 160, 198, 165]], dtype=uint8)

In [ ]: