MATLAB: Creating 9×9 average filter and applying it to an image with certain values.

filterImage Processing Toolbox

Hi again, first how to create a 9×9 average filter. I know how to create 3×3 average filter –
>> F = fspecial('average');
But how do I make it to be 9×9?
Also for the boundaries do I just put the value like that(I will show the whole code):
>> I = imread('cameraman.tif');
>> F = fspecial('average');
>> J = imfilter(I,F,255);
The last line creates the boundary to be with value X=255. Also when I do it, why I don't see any change in the picture, it shows the same picture just filtered?

Best Answer

I told you how to do a 9x9 in your duplicate question. It's just ones(9)/81.
grayImage = imread('cameraman.tif');
subplot(2,1,1);
imshow(grayImage);
title('Original Image', 'FontSize', 15);
blurredImage = imfilter(grayImage, ones(9)/81, 'symmetric');
subplot(2,1,2);
imshow(blurredImage);
title('Blurred Image', 'FontSize', 15);