Adaptative filter problem with Matlab
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello everybody
I am a trying to implement an adaptative filter, to filter images after adding a certain noise (Gaussian, Speckel, or Salt & Pepper). I have implemented a code, but after running the programm, I do not obtain the expected result. The code also contains some part that are not relevant here, the function is in adaptativefilter.m This adaptative filter is an adaptative average filter on a 3*3 neigborhood, represented by : I'(s) = sum(c*I(p))/sum(c) with c=1 if I(s)-I(p)<tau and 0 otherwise. I really do not see where this results come from! My image is too black to be just!
If someone can help me it will be really nice! Have a nice day
0 commentaires
Réponses (1)
DGM
le 9 Oct 2024
Modifié(e) : DGM
le 9 Oct 2024
Hmh. Well. I don't know what to do with this on the forum, so I'll just attach it. Both files have been fixed. Here's a short extract:
% read an image
inpict = imread('cameraman.tif');
% add gaussian noise
G = imnoise(inpict,'gaussian',0, 0.005);
% calculate error of noisy image
GaussianMSE = immse(inpict,G)
% Average filter
averagefilter = fspecial('average',3);
averageG = imfilter(G,averagefilter,'replicate');
G_MSE_average = immse(inpict,averageG)
% Adaptive filter
tau = 0.25;
adaptiveG = adaptfilter(G,tau);
G_MSE_adaptive = immse(inpict,adaptiveG)
% Median filter
medianG = medfilt2(G,[3 3]);
G_MSE_median = immse(inpict,medianG)
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!