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

2 vues (au cours des 30 derniers jours)
Filza Ashraf
Filza Ashraf le 13 Fév 2014
Commenté : Image Analyst le 18 Fév 2018
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

Réponses (2)

Image Analyst
Image Analyst le 13 Fév 2014
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 commentaires
Filza Ashraf
Filza Ashraf le 14 Fév 2014
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));

Connectez-vous pour commenter.


sairahul thota
sairahul thota le 18 Fév 2018
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