Image in Frequency Domain

By Prof. Seungchul Lee
http://iai.postech.ac.kr/
Industrial AI Lab at POSTECH

Source

• An Introduction to Digital Image Processing with MATLAB
• by Alasdair McAndrew at Victoria University of Technology

# 0. Filter on ImagesÂ¶

## 0.1. Linear System: ConvolutionÂ¶

• Computational photography at Gatech
InÂ [1]:
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
import cv2
from skimage.util import random_noise

%matplotlib inline

InÂ [2]:
# noise image

print(img.shape)

plt.figure(figsize = (10,6))

plt.imshow(img, cmap = 'gray')
plt.axis('off')
plt.show()

(512, 512)

InÂ [3]:
M = np.ones([3,3])/9
print(M)

[[0.11111111 0.11111111 0.11111111]
[0.11111111 0.11111111 0.11111111]
[0.11111111 0.11111111 0.11111111]]

InÂ [4]:
# smoothing or noise reduction

img_conv = signal.convolve2d(img, M, 'valid')

plt.figure(figsize = (10,6))

plt.subplot(1,2,1)
plt.imshow(img, cmap = 'gray')
plt.title('Noisy Image')
plt.axis('off')

plt.subplot(1,2,2)
plt.imshow(img_conv, cmap = 'gray')
plt.title('Smoothed Image')
plt.axis('off')

plt.show()

InÂ [5]:
# original image