In [1]:
%matplotlib inline
import numpy as np
import skimage.data as kdata
import skimage.io as kio
In [2]:
kio.available_plugins
Out[2]:
In [3]:
f = kdata.camera()
In [4]:
kio.use_plugin('matplotlib', 'imshow')
In [5]:
f
Out[5]:
In [6]:
def iaimginfo(f):
t = type(f)
if t != np.ndarray:
return 'Not a ndarray. It is %s' % (t,)
else:
dt = f.dtype
if dt == 'bool':
return '%s %s %s %s %s' % (t, np.shape(f), f.dtype, f.min(), f.max())
elif dt == 'uint8':
return '%s %s %s %d %d' % (t, np.shape(f), f.dtype, f.min(), f.max())
else:
return '%s %s %s %f %f' % (t, np.shape(f), f.dtype, f.min(), f.max())
In [7]:
iaimginfo(f)
Out[7]:
In [8]:
kio.imshow(f)
Out[8]:
In [ ]:
f1 = f//2
print 'f1:',iaimginfo(f1)
#kio.imshow(f1)
f2 = 128+f1
print 'f2:',iaimginfo([f1,f2])
kio.imshow(f2)
In [ ]:
g = f * 1.0
In [ ]:
iaimginfo(g)
In [ ]:
kio.imshow(g)
In [ ]: