DIP Exp 4 . [ Low Pass Filtering ]
clc;
clear;
close all;
% Read the input image
input_image = imread('sample.jpg');
% Convert the image to double for processing
input_image = double(input_image);
% Define the low-pass filter kernel (3x3 averaging filter)
filter_kernel = 1/9 * ones(3);
% Apply the filter using imfilter
filtered_image = imfilter(input_image, filter_kernel);
% Convert the filtered image back to uint8 for display
filtered_image = uint8(filtered_image);
% Display the original and filtered images
subplot(1, 2, 1);
imshow(uint8(input_image));
title('Original Image');
subplot(1, 2, 2);
imshow(filtered_image);
title('Low-pass Filtered Image');