In [1]:
%run ../common.ipynb


Populating the interactive namespace from numpy and matplotlib

In [2]:
import pywt
from __future__ import division

In [15]:
image = imread('../MP.tiff')
wimage = pywt.dwt2(image, 'haar')

In [16]:
type(wimage)


Out[16]:
tuple

In [17]:
for w in wimage:
    print type(w)


<type 'numpy.ndarray'>
<type 'tuple'>

In [18]:
size(wimage)


Out[18]:
2

In [19]:
size(wimage[1])


Out[19]:
3481632

In [20]:
size(wimage[0])


Out[20]:
1160544

In [14]:
imshow(wimage[0], cmap='gray')


Out[14]:
(<matplotlib.figure.Figure at 0x106740110>,
 <matplotlib.axes._subplots.AxesSubplot at 0x1067cd050>,
 <matplotlib.image.AxesImage at 0x114b099d0>)

In [22]:
cA, (cH, cV, cD) = wimage
print type(cH), type(cV), type(cD)


<type 'numpy.ndarray'> <type 'numpy.ndarray'> <type 'numpy.ndarray'>

In [23]:
print cH.shape, cV.shape, cD.shape


(1056, 1099) (1056, 1099) (1056, 1099)

In [24]:
image.shape


Out[24]:
(2111, 2198)

In [28]:
imshow(cA, cmap='gray')


Out[28]:
(<matplotlib.figure.Figure at 0x114b4dcd0>,
 <matplotlib.axes._subplots.AxesSubplot at 0x1068e98d0>,
 <matplotlib.image.AxesImage at 0x106023610>)

In [30]:
for i in wimage[1]:
    imshow(i, cmap='gray')



In [31]:
imshow(image, cmap='gray')


Out[31]:
(<matplotlib.figure.Figure at 0x106900690>,
 <matplotlib.axes._subplots.AxesSubplot at 0x106bcb5d0>,
 <matplotlib.image.AxesImage at 0x10c424890>)

In [ ]: