Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a5505dc

Browse files
Neighbourhood Processing
Low Pass Filtering, High Pass Filtering, Median Pass Filtering
1 parent 8187773 commit a5505dc

File tree

6 files changed

+74
-0
lines changed

6 files changed

+74
-0
lines changed
3 MB
Binary file not shown.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
%High pass Filtering
2+
3+
clc;
4+
clear all;
5+
a=imread('pout.tif');
6+
b=imnoise(a,'gaussian');
7+
a=double(a);
8+
b=double(b);
9+
w=[-1/9 -1/9 -1/9;-1/9 -1/9 8/9;-1/9 -1/9 -1/9];
10+
[m n]=size(b);
11+
for i=2:1:m-1
12+
for j=2:1:n-1
13+
r(i,j)=b(i-1,j-1)*w(1)+b(i-1,j)*w(2)+ b(i-1,j+1)*w(3)+ b(i,j-1)*w(4)+ b(i,j)*w(5)+ b(i,j+1)*w(6)+ b(i+1,j-1)*w(7)+ b(i+1,j)*w(8)+ b(i+1,j+1)*w(9) ;
14+
end
15+
end
16+
subplot(3,3,1)
17+
imshow(uint8(a));
18+
title('Original Image')
19+
subplot(3,3,2)
20+
imshow(uint8(b));
21+
title('Image with Gaussian Noise')
22+
subplot(3,3,3)
23+
imshow(uint8(r));
24+
title('High Pass Filtered Image')
3 MB
Binary file not shown.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
%Low pass Filtering
2+
3+
clc;
4+
clear all;
5+
a=imread('pout.tif');
6+
b=imnoise(a,'gaussian');
7+
a=double(a);
8+
b=double(b);
9+
w=[1/9 1/9 1/9;1/9 1/9 1/9;1/9 1/9 1/9];
10+
[m n]=size(b);
11+
for i=2:1:m-1
12+
for j=2:1:n-1
13+
r(i,j)=b(i-1,j-1)*w(1)+b(i-1,j)*w(2)+ b(i-1,j+1)*w(3)+ b(i,j-1)*w(4)+ b(i,j)*w(5)+ b(i,j+1)*w(6)+ b(i+1,j-1)*w(7)+ b(i+1,j)*w(8)+ b(i+1,j+1)*w(9) ;
14+
end
15+
end
16+
subplot(3,3,1)
17+
imshow(uint8(a));
18+
title('Original Image')
19+
subplot(3,3,2)
20+
imshow(uint8(b));
21+
title('Image with Gaussian Noise')
22+
subplot(3,3,3)
23+
imshow(uint8(r));
24+
title('Low Pass Filtered Image')
3 MB
Binary file not shown.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
%Median Filtering
2+
3+
clc;
4+
clear all;
5+
a=imread('coins.png');
6+
c=imnoise(a,'salt & pepper',0.02);
7+
c=double(c);
8+
9+
[m n]=size(a);
10+
for i=2:1:m-1
11+
for j=2:1:n-1
12+
r=[c(i-1,j-1) c(i-1,j) c(i-1,j+1) c(i,j-1) c(i,j) c(i,j+1) c(i+1,j-1) c(i+1,j) c(i+1,j+1)];
13+
b=sort(r);
14+
d(i,j)= median(b);
15+
end
16+
end
17+
18+
subplot(2,2,1)
19+
imshow(uint8(a));
20+
title('Original Image')
21+
subplot(2,2,2)
22+
imshow(uint8(c));
23+
title('Image with Salt and Pepper Noise')
24+
subplot(2,2,3)
25+
imshow(uint8(d));
26+
title('Median Filtered Image')

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /