I'm trying to split a greyscale image (that has 'Salt and pepper noise') into 3x3 blocks, then take the average of each block
and scale the original image with its respective block. The result should remove most of the noise and smoothen the image.
For now this is just testing a single block on the image. The average is too large, so all pixels turn white.
I do not know how to apply this average in the correct way. Any ideas would be greatly appreciated.
A = imread("noisypeppers.tif");
[r,c] = size(A);
n = 3;
M = zeros(n,n);
m = [];
for i = 1:n
for j = 1:n
m = [m;A(i,j)];
end
end
m = sum(m)/n*n;
M(:,:)/> = m;
for i = 1:n
for j = 1:n
A(i,j) = M(i,j)*A(i,j);
end
end
imshow(A)

New Topic/Question
Reply



MultiQuote




|