DSP is used extensively in image processing. For example as an in class project, lets remove the dithering patterns of dots in this image of Donald Duck
.
These dots occur in the printing process used in newspapers in the past as a way to shade the picture without fine pixel or color control. The process was developed in the early nineteenth century by Ben Day, and is called the [Ben Day process].(https://en.wikipedia.org/wiki/Ben_Day_process)
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
im = plt.imread("Donald_Duck.png")
im.shape
print(im.shape)
def plti(im, h=8, **kwargs):
"""
Helper function to plot an image.
"""
y = im.shape[0]
x = im.shape[1]
w = (y/x) * h
plt.figure(figsize=(w,h))
plt.imshow(im, interpolation="none", **kwargs)
plt.axis('off')
plt.show()
plti(im)
im1 = im[10:im.shape[0]-10, 10:im.shape[1]-10]
def rgb2gray(rgb):
return np.dot(rgb[...,:3], [0.2989, 0.5870, 0.1140])
gray_im = rgb2gray(im1)
plt.gray() # Means all further plots will be gray scale.
plti(gray_im)
Hint: See this web page if you have no ideas, but first please think about it and look at the image closely to see if you can figure it out yourself.