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


Populating the interactive namespace from numpy and matplotlib

In [57]:
image = imread('../MP.tiff')
gimshow(image)
histshow(image)



In [43]:
F = fft2(image)

In [4]:
F.shape


Out[4]:
(2111, 2198)

In [27]:
x,y = meshgrid(range(F.shape[1]), range(F.shape[0]))
mask = sqrt((x-F.shape[0]/2)**2 + (y-F.shape[1]/2)**2) > 100
F = fftshift(F)
F[mask] = 0
F = ifftshift(F)

In [45]:
f = ifft2(F).real

In [46]:
f


Out[46]:
array([[ 6.33247804,  6.40232862,  6.46811974, ...,  6.17731363,
         6.21079396,  6.26566524],
       [ 6.27309675,  6.38228309,  6.49451045, ...,  6.05758015,
         6.1013784 ,  6.1762106 ],
       [ 6.2468854 ,  6.38744443,  6.53880333, ...,  5.98911987,
         6.03906424,  6.12754852],
       ..., 
       [ 6.69423665,  6.60960883,  6.50827784, ...,  6.8304709 ,
         6.80161342,  6.75797105],
       [ 6.54629566,  6.51791722,  6.47526652, ...,  6.56763377,
         6.56517715,  6.56060276],
       [ 6.42428967,  6.44786701,  6.46147835, ...,  6.34816997,
         6.36639959,  6.39477441]])

In [58]:
gimshow(f)
histshow(f.astype(np.uint8))



In [60]:
imsave('lp-ideal.tif', f.astype(np.uint8))