Question: In [ 1 4 ] : # MN _ 2 _ Fourier _ Transfors. ipnybinport numpy as np Inport pylab import matplotlib.pyplot as plt from

In [14]: # MN_2_Fourier_Transfors. ipnybinport numpy as np
Inport pylab
import matplotlib.pyplot as plt
from PIL import Image, ImageDraw
w,h =65,65
shape =[(10,10),(w -10, h -10)]
im1= Image.new("RGB",(( w, h))
ing = InageDraw.Draw(im1)
img.ellipse(shape, fill ="red", outline ="blue")
pylab.imshow(im1)
pylab.title('Circle')
pylab.show
im2= Image.new("RGB",(}|,h)\mathrm{))
ing = ImageDraw.Draw(im2)
ing.rectangle(shape, fill ="yellow", outline ="purple")
pylab.inshow(im2)
pylab.title('Box')
pylab.show
f = plt.figure()
f.add_subplot(1,2,1)
plt. inshow(np.rot9e(im1,2))
f,add_subplot(1,2,2)
plt. inshow(np.rot9e(in,2))
plt.show(block=True)
Task 2:
Perform a Fourier analysis on the two above images. The program should do the following:
draws 2 separate images
takes the 2D discrete Fourier transform of one of the images (HINT: using the numpy package, look at fft2 and fftshift)
applies a gaussian filter to the image
takes the inverse transform of the image (HINT: using the numpy package, look at ifft2)
displays the blurred image
There are many ways you can attempt each of these steps, so I would recommend doing some research online.
The SciPy documentation on the scipy website is helpful if you're unsure where to start.
Gaussian Filter: A Gaussian Filter is used in reducing noise in the image, and also the details of the image. The Gaussian function based on the size of
(standard deviation) is defined as:
G=122e-(2+x2)22
where x is the distance from the origin in the horizontal axis, y is the distance from the origin in the vertical axis, and is the standard deviation of the
Gaussian distribution. For the purposes of this lab, you can experiment which different values of 0. If you are unsure, try a value of 10. Your output should look
something like this for the cross image shown above (from left to right, 2D discrete Fourier transform, gaussian filter applied, and the final blurred image):
In [ 1 4 ] : # MN _ 2 _ Fourier _ Transfors.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!