need code for weight median filter for de-noising of a gray scale image

1 次查看(过去 30 天)
here is an image but i couldn't get a valid code on net the code that i found iy didnt give me back a gray scale image with removed noise but the output of those code is too dark so hope i'll get some help here
so attaching the image here and waiting for response

回答(2 个)

Image Analyst
Image Analyst 2014-2-13
Did you try
filteredImage = medfilt2(grayImage, [9, 9]);
??? Exactly what code did you find or not find, or run? Did it give you an output image at all (even if it was dark) or not? Your statement is not clear.
  2 个评论
Filza Ashraf
Filza Ashraf 2014-2-14
i have been using this code
I = imread('p1.png');
I = double (I);
Z = imnoise(I,'salt & pepper',0.02);
a = double(Z);
b = a;
W = [1,1,1; 1,1,1; 1,1,1]/9;
[row col] = size(a);
for x = 2:1:row-1
for y = 2:1:col-1
a1 = [W(1)*a(x-1,y-1) W(2)*a(x-1,y) W(3)*a(x-1,y+1) ... W(4)*a(x,y-1) W(5)*a(x,y) W(6)*a(x,y+1)... W(7)*a(x+1,y-1) W(8)*a(x+1,y) W(9)*a(x+1,y+1)];
a2 = sort(a1);
med = a2(5);
b(x,y) = med;
end
end
figure(3); imshow(uint8(b)); figure(4); imshow(uint8(Z));

请先登录,再进行评论。


sairahul thota
sairahul thota 2018-2-18
sir i need code for the removal of salt and pepper noise in image using adaptive median filter

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by