Image processing starter kit

There are a number of images we will use in this project so please download and unzip them. Make sure that you save the zip file in the repository for the class. The files are called: phobos2.jpg, obama.png, Veggies_noise.jpg, eye.png, guesswho.png, pcb.png, bonkers.png. Make sure the files are in the same repo directory as your images.ipynb file (a copy of this notebook renamed).

View


In [5]:
from PIL import Image

img = Image.open('eye.png')
img = img.convert("L") # grayscale
img   # same as display(img)


Out[5]:

Flip


In [ ]:
# define function flip()
# open 'eye.png', convert to grayscale, flip, and display

Blur


In [ ]:
# define getpixel, region3x3, avg, and blur functions

img = Image.open('pcb.png')
img = img.convert("L") # make greyscale if not already (luminance)
img

In [ ]:
img = blur(img)
img

Denoise


In [ ]:
# define median and denoise functions

In [ ]:
img = Image.open('Veggies_noise.jpg')
img = img.convert("L") # make greyscale if not already (luminance)

In [ ]:
# denoise 3 times and display

In [ ]:
# show 'guesswho.png'

In [ ]:
# denoise 3 times then display

Generic filter


In [ ]:
# define filterAnd open functions

Blur refactored


In [ ]:
# Display 'pcb.png'
img

In [ ]:
# use filter to blur the image

Denoise refactored


In [ ]:
img = open('guesswho.png')
img

In [ ]:
# using filter function, denoise the image

Edges


In [ ]:
# define laplace function
# Open 'obama.png' and show the edges

In [ ]:
# Show the edges for 'phobos2.jpg

Sharpen


In [ ]:
# define minus function

In [ ]:
# display 'bonkers.png'

In [ ]:
# sharpen that image and display it