-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNonLinearFilters.m
58 lines (45 loc) · 909 Bytes
/
NonLinearFilters.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
clc;
close all;
clear;
img=imread('lenaSzum.bmp');
figure(1);
subplot(1,3,1);
imshow(img);
title("orginal");
subplot(1,3,2);
imshow(medfilt2(img));
title("orginal");
subplot(1,3,3);
imshow(imabsdiff(img,medfilt2(img)));
title("orginal");
%%
img_2=imread('lena.bmp');
mask=fspecial('average',3);
img_filtered_med=medfilt2(img_2);
img_filtered=conv2(img_filtered_med,mask,'same');
figure(2);
subplot(1,3,1);
imshow(img_2);
title("Orginal");
subplot(1,3,2);
imshow(uint8(img_filtered));
title("Filterd med+avrg");
subplot(1,3,3);
imshow(imabsdiff(img_2, uint8(img_filtered)));
title("Diff");
%%
img_3=imread('lena.bmp');
img_filtered=img_3;
for z=1:10
img_filtered=medfilt2(img_filtered,[5,5]);
end
figure(3);
subplot(1,3,1);
imshow(img_3);
title("Orginal");
subplot(1,3,2);
imshow(img_filtered);
title("Filterd 10 times");
subplot(1,3,3);
imshow(imabsdiff(img_3, img_filtered));
title("Diff");