Assign1 Spring 2025
Assign1 Spring 2025
The purpose of this homework is to write an image filtering function to apply on input images. Image
filtering (or convolution) is a fundamental image processing tool to modify the image with some
smoothing or sharpening affect. You will be writing your own function to implement image filtering
from scratch. More specifically, you will implement a filter( ) function that should conform to the
following:
(2) support arbitrarily shaped filters where both dimensions are odd (e.g., 3 × 3 filters, 5 × 5 filters),
(3) pad the input image with the same pixels as in the outer row and columns, and
(4) return a filtered image which is the same resolution as the input image.
You should read a color image and then convert it to grayscale. Then define different types of
smoothing and sharpening filters such as box, sobel, etc. Before you apply the filter on the image
matrix, apply padding operation on the image so that after filtering, the output filtered image
resolution remains the same. (Please refer to the end the basic image processing notebook file
that we used in the class to see how you can pad an image)
Then you should use nested loops (two for loops for row and column) for filtering operation by
matrix multiplication and addition (using image window and filter). Once filtering is completed,
display the filtered image.
Submission
You should submit (using Blackboard link) the source file which includes the code (Jupiter
notebook) and a report containing different filters and corresponding filtered images.