
Creating 9x9 average filter and applying it to an image with certain values.
27 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lachezar Petkov
am 19 Okt. 2015
Beantwortet: Simran Kumari
am 10 Feb. 2022
Hi again, first how to create a 9x9 average filter. I know how to create 3x3 average filter -
>> F = fspecial('average');
But how do I make it to be 9x9?
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?
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 19 Okt. 2015
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);

3 Kommentare
Atalay Asa
am 7 Jun. 2020
Do average filter and average mean filter are same thing? Can we use your code for 9x9 arithmetic mean filter?
Image Analyst
am 7 Jun. 2020
Yes, as far as I know they're the same. average and mean are just two words for the same thing and doubling them up doesn't really change the meaning. Yes, my code does a 9x9 filter. More generally
grayImage = imread('cameraman.tif');
subplot(2,1,1);
imshow(grayImage);
title('Original Image', 'FontSize', 15);
windowSize = 9; % Whatever you want.
kernel = ones(windowSize, windowSize) / windowSize ^ 2;
blurredImage = imfilter(grayImage, kernel, 'symmetric');
subplot(2,1,2);
imshow(blurredImage);
title('Blurred Image', 'FontSize', 15);
Weitere Antworten (2)
Santhosh Prasad M
am 26 Jan. 2019
Bearbeitet: Santhosh Prasad M
am 26 Jan. 2019
I = imread('cameraman.tif');
figure,imshow(I);title('Original Image');
C=fspecial('average',[9,9]); %exact 9x9 average filter
d=imfilter(I,C);
figure,imshow(d);title('9x9 average filter');
0 Kommentare
Simran Kumari
am 10 Feb. 2022
img = imread('exp3.jpeg');
subplot(2,2,1);
imshow(img);
title('Original Image');
I=rgb2gray(img);
subplot(2,2,2);
imshow(I);
title('gray image');
windowSize = 3; % Whatever you want.
kernel = ones(windowSize, windowSize) / windowSize ^ 2;
d = imfilter(I, kernel, 'symmetric');
subplot(2,2,3);
imshow(d);
title('image after filter');
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matched Filter and Ambiguity Function finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!