Starting from:

$24.99

EC69211 Experiment 4-SPATIAL FILTERING Solution

SPATIAL FILTERING

Problem Objective:

Q 1. Write python modular functions/subroutines to design spatial filters - Mean, Median,
Prewitt, Laplacian, Sobel kernels (horizontal, vertical, diagonal), Gaussian Blur, Laplacian of Gaussian on a stack of grayscale images (say, 15 images per stack).

Use OpenCV for image reading, writing and showing only.


Output: Filtered image.






Q 2. Create a filter called Gaussian_Unblur to undo the effects of blurring. It can be implemented by executing the following iterative steps:

Let 𝐼0 be the blurry input image, 𝐼𝑘 be the corrected image at iteration 𝑘, and 𝐺𝜎 a Gaussian filter. Iterate the following steps over 𝑘 = 0, 1, 2, . ..


1. Compute 𝐴𝑘 = 𝐼𝑘 ∗ 𝐺𝜎 (convolution)
2. Set, 𝐵𝑘 = 𝐼0/𝐴𝑘 (pixel by pixel division)
3. Compute 𝐶𝑘 = 𝐵𝑘 ∗ 𝐺𝜎 (convolution)
4. Set, 𝐼𝑘+1 = 𝐼𝑘 ∗ 𝐶𝑘 (pixel by pixel multiplication)

You should run these steps until the image 𝐼𝑘 converges, that is, the change from one iteration to the next is very small (choose a small value). Set a maximum iteration count to bail out just in case it doesn't converge.

Input: Choose any of the given image, and apply your previously implemented Gaussian blur filter with 𝜎 = 1. Then use the blurred image as input for this question. For un-blurring also use 𝜎 = 1

Output: The corrected image.

Note
1. Do not hardcode the filenames and/or image size into the code.
2. Use proper code commenting and documentation.
3. Use self-explanatory identifiers for variables/functions etc.

References
1. Gonzalez, Woods “Digital image processing” 3/e, Chapter 3, Prentice Hall.
2. NPTEL Lectures on Digital Image Processing by Prof. P.K.Biswas.

More products