sigma = 4.0 [Gx, x] = gauss_module.gauss(sigma) plt.figure(1) plt.plot(x, Gx, '.-') plt.show() ## function gaussianfilter (Question 1.b) img = rgb2gray( np.array( Image.open( "/Users/edoardogabrielli/Documents/Università/ComputerScience/FoundationsOfDataScience/fds-2021/A1/Filtering/graf.png" ))) smooth_img = gauss_module.gaussianfilter(img, sigma) plt.figure(2) ax1 = plt.subplot(1, 2, 1) ax2 = plt.subplot(1, 2, 2) plt.sca(ax1) plt.imshow(img, cmap='gray', vmin=0, vmax=255) plt.sca(ax2) plt.imshow(smooth_img, cmap='gray', vmin=0, vmax=255) plt.show() ## function gaussdx (Question 1.c) sigma = 4.0 [Gx, x] = gauss_module.gauss(sigma) [Dx, x] = gauss_module.gaussdx(sigma)
## function gauss (Question 1.a) sigma = 4.0 [Gx, x] = gauss_module.gauss(sigma) plt.figure(1) plt.plot(x, Gx, '.-') plt.show() ## function gaussianfilter (Question 1.b) img = rgb2gray(np.array(Image.open('graf.png'))) smooth_img = gauss_module.gaussianfilter(img, sigma) plt.figure(2) ax1 = plt.subplot(1,2,1) ax2 = plt.subplot(1,2,2) plt.sca(ax1) plt.imshow(img, cmap='gray', vmin=0, vmax=255) plt.sca(ax2) plt.imshow(smooth_img, cmap='gray', vmin=0, vmax=255) plt.show() ## function gaussdx (Question 1.c) sigma = 4.0