我被困在这里,我多次尝试但无法得到我的最终答案。
代码:
I = imread('C:\Users\Ahsan\Desktop\pears.png');
H = fspecial('average', [3 3]);
J = imfilter(I, H);
figure, imshow(I);
figure, imshow(J);
答案 0 :(得分:1)
试试这个: (也许你必须改变门槛);
threshold = 126;
image = imread('C:\Users\Ahsan\Desktop\pears.png');
% Apply the filder
filterImage = conv2(image, ones(3)/9, 'same');
% Check which pixels are equal or greater than the threshold
masked = filterImage >= threshold;
% Replace all pixels of the filteredImage which are below the threshold
% with the original pixels.
filterImage(~masked) = image(~masked);
% Display result
figure(1);
subplot(1,2,1);
imshow(image, []);
subplot(1,2,2);
imshow(filterImage, []);