In [16]:
from scipy import ndimage
import numpy as np
In [2]:
from scipy import misc
In [3]:
f = misc.face()
In [4]:
misc.imsave('face.png', f)
In [7]:
import matplotlib.pyplot as plt
%matplotlib inline
In [8]:
plt.imshow(f)
Out[8]:
In [9]:
face = misc.face()
In [10]:
misc.imsave('face.png', face)
In [11]:
face = misc.imread('face.png')
In [12]:
type(face)
Out[12]:
In [13]:
face.shape, face.dtype
Out[13]:
In [14]:
face.tofile('face.raw')
In [18]:
face_from_raw = np.fromfile('face.raw', dtype=np.uint8)
In [19]:
face_from_raw.shape
Out[19]:
In [20]:
face_from_raw.shape = (768, 1024,3)
In [21]:
face_memmap = np.memmap('face.raw', dtype=np.uint8, shape=(768, 1024, 3))
In [ ]: