【发布时间】:2019-04-05 12:30:26
【问题描述】:
我的输出有问题。我正在使用 5*5 滤镜使图像平滑。作为平均滤波器平滑我们的图像,但这个使图像更加沉闷。谁能帮我解决这个问题?
输入图像是:
img_2 = imread('White-Bars.png');
filter = ones(5 , 5)/25;
working_img = img_2(:,:,1);
img_4 = img_2(:,:,1);
[rows,cols] = size(working_img); sum=0;
for row=4:(rows-3)
for col=4:(cols-3)
for rowindex=(-2): (3)
for colindex=(-2): (3)
img_4(row,col) = mean2(double(working_img(row+rowindex,col+colindex)) * filter(1:5,1:5));
end
end
end
end
subplot(1,2,1);
imshow(working_img);
subplot(1,2,2);
imshow(img_4);
所以,这是输出:
【问题讨论】:
-
过滤器的尺寸是多少?还可以尝试高斯滤波器而不是简单的平均,因为简单的平均滤波器会在图像中放置像伪像一样的框。还要在这里显示您的代码,以便我们可以看到您的代码有什么问题
-
嘿@AnderBiguri 现在你能帮我吗?
-
当您将过滤器除以 25 时,您就不必使用
mean2函数,仅此而已。而不是mean2,您必须对像素求和