Adaptative filter problem with Matlab

4 visualizzazioni (ultimi 30 giorni)
Jeremy le Gall
Jeremy le Gall il 3 Dic 2015
Modificato: DGM il 9 Ott 2024
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

Risposte (1)

DGM
DGM il 9 Ott 2024
Modificato: DGM il 9 Ott 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)
GaussianMSE = 301.5089
% Average filter
averagefilter = fspecial('average',3);
averageG = imfilter(G,averagefilter,'replicate');
G_MSE_average = immse(inpict,averageG)
G_MSE_average = 199.9479
% Adaptive filter
tau = 0.25;
adaptiveG = adaptfilter(G,tau);
G_MSE_adaptive = immse(inpict,adaptiveG)
G_MSE_adaptive = 96.3750
% Median filter
medianG = medfilt2(G,[3 3]);
G_MSE_median = immse(inpict,medianG)
G_MSE_median = 187.6114

Community Treasure Hunt

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

Start Hunting!

Translated by