from PIL import Image
from numpy import *
from scipy.ndimage import filters
im=array(Image.open(‘lena.jpg’).convert(‘L’))
im2=filters.gaussian_filter(im,5)
img=Image.fromarray(im)
img.show()
img2=Image.fromarray(im2)
img2.show()
imx=zeros(im.shape)
filters.sobel(im,1,imx)
imy=zeros(im.shape)
filters.sobel(im,0,imy)
magnitude=sqrt(imx**2+imy**2)
magnitudeimg=Image.fromarray(uint8(magnitude))
magnitudeimg.show()