Mean Filtering
The mean (also known as neighborhood averaging) filter is perhaps the simplest and most widely known spatial smoothing filter. It uses convolution with a (usually 3 ×3) mask whose coefficients have a value of 1 and divides the result by a scaling factor (the total number of elements in the mask). A neighborhood averaging filter in which all coefficients are equal is also referred to as a box filter.
The convolution mask for a 3 × 3 mean filter is given by :
Example
a = imread('image1.jpg'); % reading image b = [1 1 1; 1 1 1; 1 1 1;]/9; % Mean filter convolution c = imfilter(a,b); % mean filtering subplot(1,2,1); imshow(a); title('Original Image'); subplot(1,2,2); imshow(c); title('Filtered Image');