import numpy as np 
import matplotlib.pyplot as plt
from skimage.exposure import rescale_intensity

from unsharp import *

# Load file and normalize to 0-1
fname = 'iguana.jpg'
im = plt.imread(fname)
if im.mean() >= 1:
    im = im/255.

sigma = 5
amplitude = 1.5
imsharp = unsharp_mask(im, sigma, amplitude)
imsharp = rescale_intensity(imsharp, in_range=(0, 1), out_range=(0,1))

new_fname = fname[:-4]+'_sharp.jpg'
plt.imsave(new_fname, imsharp)
[((9, 5, 9, 22), 'matplotlib.pyplot.imread', 'plt.imread', ({(9, 16, 9, 21): 'fname'}, {}), '(fname)', True, 'import matplotlib.pyplot as plt\n'), ((16, 10, 16, 70), 'skimage.exposure.rescale_intensity', 'rescale_intensity', (), '', False, 'from skimage.exposure import rescale_intensity\n'), ((19, 0, 19, 30), 'matplotlib.pyplot.imsave', 'plt.imsave', ({(19, 11, 19, 20): 'new_fname', (19, 22, 19, 29): 'imsharp'}, {}), '(new_fname, imsharp)', True, 'import matplotlib.pyplot as plt\n')]