help Adaptive median filter !!
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
DGM
el 29 de Sept. de 2023
This answer discusses and provides a link to an implementation of a similar adaptive median filter:
0 comentarios
Ver también
Categorías
Más información sobre Adaptive Filters en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!