help Adaptive median filter !!

조회 수: 3 (최근 30일)
aliah aljohani
aliah aljohani 2017년 10월 13일
답변: DGM 2023년 9월 29일
a=imread('hh1.tif');
figure(1),imshow(a),title('origanal image');
b=imnoise(a,'salt & pepper',.02);
figure(2),imshow(b),title('noisy image');
Smax=9;
for i=1:254
for j=1:254
n=b(i:i+2,j:j+2)
Zmin=min(n(:));
Zmax=max(n(:));
Zmed=median(n(:));
sx=3;
sy=3;
A1=Zmed-Zmin;
A2=Zmed-Zmax;
if (A1>0) && (A2<0)
B1 = Zxy-Zmin;
B2 = Zxy-Zmax;
if (B1>0) && (B2<0)
b(i:i+2,j:j+2) = n(i, j);
break;
else
b(i:i+2,j:j+2) = Zmed;
break;
end
else
sx=sx+2;
sy=sy+2;
if (sx > Smax) && (sy > Smax)
b(i:i+2,j:j+2) = n(i, j);
end
end
end
end
figure(3),imshow(b),title('denoised image');
i have problem withe for and if
i have error

답변 (1개)

DGM
DGM 2023년 9월 29일
This answer discusses and provides a link to an implementation of a similar adaptive median filter:

카테고리

Help CenterFile Exchange에서 Adaptive Filters에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by