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

조회 수: 2 (최근 30일)
Filza Ashraf
Filza Ashraf 2014년 2월 13일
댓글: Image Analyst 2018년 2월 18일
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