Skip to content
This repository was archived by the owner on Jan 23, 2022. It is now read-only.

Commit cccaf6c

Browse files
author
SunYufei
committed
Update: 2019/12/29
1 parent bc0f9dd commit cccaf6c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1115
-4
lines changed

Extra/15 Final Exam with Answer.pdf

1.31 KB
Binary file not shown.

Extra/15 Final Exam.pdf

-216 KB
Binary file not shown.

Extra/15 Final Exam/Final Exam with Answer.ipynb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,7 @@
221221
"cell_type": "markdown",
222222
"metadata": {},
223223
"source": [
224-
"### Show the difference between the two smoothed images.\n",
225-
"\n",
226-
"Note the numeric type of the variable."
224+
"### Show the 1st channel of difference between the two smoothed images."
227225
]
228226
},
229227
{
@@ -253,7 +251,8 @@
253251
"diff = imsubtract(new_hsi, new_rgb);\n",
254252
"% diff = new_rgb - new_hsi; % also right\n",
255253
"% diff = new_hsi - new_rgb; % also right\n",
256-
"figure, imshow(diff(:, :, 1));"
254+
"figure, imshow(diff(:, :, 1));\n",
255+
"% figure, imshow(diff(:, :, 1), []); % also right"
257256
]
258257
},
259258
{

Extra/Final Exam.pdf

223 KB
Binary file not shown.

Students' Code/BK2017070.m

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
x = 0:10;
2+
y = x;
3+
plot(x, y)
4+
f = imread('lenna.tif');
5+
figure, imshow(f);
6+
r = f(:, :, 1);
7+
g = f(:, :, 2);
8+
b = f(:, :, 3);
9+
10+
figure
11+
subplot(131), imshow(r), title('Red');
12+
subplot(132), imshow(g), title('Green');
13+
subplot(133), imshow(b), title('Blue');
14+
hsi = rgb2hsi(f);
15+
h = hsi(:, :, 1);
16+
s = hsi(:, :, 2);
17+
i = hsi(:, :, 3);
18+
figure,
19+
subplot(131), imshow(h), title('hue');
20+
subplot(132), imshow(s), title('saturation');
21+
subplot(133), imshow(i), title('Intensity');
22+
p = fspecial('average', [5 5]);
23+
t = imfilter(r, p);
24+
figure, imshow(t);
25+
p = fspecial('average', [5 5]);
26+
e = imfilter(g, p);
27+
figure, imshow(e);
28+
p = fspecial('average', [5 5]);
29+
t = imfilter(b, p);
30+
figure, imshow(t);
31+
p = fspecial('average', [5 5]);
32+
d = imfilter(i, p);
33+
figure, imshow(d);
34+
35+
36+
t = -5:5;
37+
x=0;
38+
for k = 1:20
39+
x = x+1/k * (sin((k*pi)/2))*(cos((k*pi*t)/2));
40+
end
41+
plot(t, x);
42+
title('Daniye')
43+
44+
45+
46+
47+
48+
49+
50+
51+
52+

Students' Code/BK2017072.m

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
f = imread('lenna.tif');
2+
imshow(f);
3+
r = f(:, :, 1);
4+
g = f(:, :, 2);
5+
b = f(:, :, 3);
6+
figure
7+
subplot(131), imshow(r), title('Red');
8+
subplot(132), imshow(g), title('Green');
9+
subplot(133), imshow(b), title('Blue');
10+
11+
hsi = rgb2hsi(f);
12+
h = hsi(:, :, 1);
13+
s = hsi(:, :, 2);
14+
i = hsi(:, :, 3);
15+
figure
16+
subplot(131), imshow(h), title('Hue');
17+
subplot(132), imshow(s), title('Saturation');
18+
subplot(133), imshow(i), title('Intensity');
19+
20+
r1 = fspecial('average',[5 5]);
21+
r2 = imfilter(r, r1);
22+
g1 = fspecial('average',[5 5]);
23+
g2 = imfilter(g, r1);
24+
b1 = fspecial('average',[5 5]);
25+
b2 = imfilter(b, r1);
26+
27+
rgbfinal = cat(3, r2, g2, b2);
28+
figure, imshow(rgbfinal);
29+
30+
31+
i1 = fspecial('average',[5 5]);
32+
i2 = imfilter(i, i1);
33+
34+
hsifinal = cat(3, h, s, i2);
35+
%figure, imshow(hsifinal);
36+
37+
convertToRGB = hsi2rgb(hsifinal);
38+
figure, imshow(convertToRGB);
39+
40+
%diff = rgbfinal - convert2RGB;
41+
%figure, imshow(diff);
42+
43+
%k = 1:20;
44+
%t = -5:5;
45+
%a = (1 * k.^-1);
46+
%b = (k * pi)* (1 * 2.^-1);
47+
%x = a * sin(b);
48+
%plot(x, t), title('Greatfortune Mamhova'), legend('x(t)'), xlabel('t'), ylabel('x');
49+
50+
51+
52+
53+
54+
55+
56+

Students' Code/BK2017073.m

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
%Question one
2+
f = imread('lenna.tif');
3+
figure,imshow(f);
4+
%question two
5+
r = f(:,:,1);
6+
g = f(:,:,2);
7+
b = f(:,:,3);
8+
figure
9+
subplot(131),imshow(r),title('Red');
10+
subplot(132),imshow(g),title('Green');
11+
subplot(133),imshow(b),title('Blue');
12+
%question three
13+
hsi = rgb2hsi(f);
14+
h = hsi(:,:,1);
15+
s = hsi(:,:,2);
16+
i = hsi(:,:,3);
17+
figure
18+
subplot(131),imshow(h),title('Hue');
19+
subplot(132),imshow(s),title('Saturation');
20+
subplot(133),imshow(i),title('Intensity');
21+
%question four
22+
smoothing = fspecial('average',[5 5]);
23+
rsmooth = imfilter(r,smoothing);
24+
gsmooth = imfilter(g,smoothing);
25+
bsmooth = imfilter(b,smoothing);
26+
rgb_smooth = cat(3,rsmooth,gsmooth,bsmooth);
27+
figure,imshow(rgb_smooth);
28+
%question five A
29+
ismooth = imfilter(i,smoothing);
30+
hsi_rgb_smooth = cat(3,h,s,ismooth);
31+
rgb = hsi2rgb(hsi_rgb_smooth);
32+
figure,imshow(rgb);
33+
34+
%question five B
35+
%minus = rgb_smooth - rgb;
36+
%fc = minus(:,:,1);
37+
%figure,imshow(fc);
38+
39+
%question six
40+
t = -5:5;
41+
x = 0;
42+
p = pi/2;
43+
c = pi*t/2;
44+
for k =1:20
45+
x = x + ((1/k)*(sin(p*k)) * cos((c*k)));
46+
end
47+
figure
48+
plot(t,x)
49+
title('Austin Madangwa BK2017073')
50+
xlabel('t')
51+
ylabel('x')
52+
legend('x = x(t)')

Students' Code/BK2017074.m

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
%show original image
2+
f=imread('lenna.tif');
3+
figure,imshow('lenna.tif');
4+
% RGB color
5+
r = f(:, :, 1);
6+
g = f(:, :, 2);
7+
b = f(:, :, 3);
8+
9+
figure
10+
subplot(131), imshow(r), title('Red');
11+
subplot(132), imshow(g), title('Green');
12+
subplot(133), imshow(b), title('Blue');
13+
14+
% Question 3 HSI
15+
16+
hsi = rgb2hsi(f);
17+
h = hsi(:, :, 1);
18+
s = hsi(:, :, 2);
19+
i = hsi(:, :, 3);
20+
21+
figure
22+
subplot(131), imshow(h), title('Hue');
23+
subplot(132), imshow(s), title('Saturation');
24+
subplot(133), imshow(i), title('Intensity');
25+
26+
% Question 4
27+
r1=fspecial('average',[5 5]);
28+
red=imfilter(r,r1);
29+
%imshow(red);
30+
31+
g1=fspecial('average',[5 5]);
32+
green=imfilter(g,g1);
33+
%imshow(green);
34+
35+
b1=fspecial('average',[5 5]);
36+
blue=imfilter(b,b1);
37+
%imshow(blue);
38+
rgb=cat(3,red,blue,green);
39+
figure,imshow(rgb);
40+
41+
%Question 5
42+
h1=fspecial('average',[5 5]);
43+
hue=imfilter(h,h1);
44+
%imshow(hue);
45+
46+
s1=fspecial('average',[5 5]);
47+
saturation=imfilter(s,s1);
48+
%imshow(saturation);
49+
50+
i1=fspecial('average',[5 5]);
51+
intensity=imfilter(i,i1);
52+
%imshow(intensity);
53+
hsi=cat(3,hue,saturation,intensity);
54+
figure,imshow(hsi);
55+
56+
%graph
57+
k = 1:20;
58+
t = -5:5;
59+
a = (1 * k.^-1);
60+
b = (k * pi)* (1 * 2.^-1);
61+
x = a * sin(b);
62+
plot(x, t), title('Evans Muchinguri'), legend('x(t)'), xlabel('t'), ylabel('x');
63+
64+
65+
66+
67+
68+
69+
70+
71+
72+
73+
74+
75+

Students' Code/BK2017075.m

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
f=imread('lenna.tif');
2+
imshow(f);
3+
r= f(:, :, 1);
4+
g= f(:, :, 2);
5+
b= f(:, :, 3);
6+
7+
figure
8+
subplot(131), imshow(r), title('Red');
9+
subplot(132), imshow(g), title('Green');
10+
subplot(133), imshow(b), title('Blue');
11+
12+
hsi= rgb2hsi(f);
13+
h= hsi(:, :, 1);
14+
s= hsi(:, :, 2);
15+
i= hsi(:, :, 3);
16+
17+
figure
18+
subplot(131), imshow(h), title('Hue');
19+
subplot(132), imshow(s), title('Saturation');
20+
subplot(133), imshow(i), title('Intensity');
21+
22+
r5= fspecial('average', [5 5]);
23+
rr5= imfilter(r, r5);
24+
figure, imshow(rr5);
25+
26+
g5= fspecial('average', [5 5]);
27+
gg5= imfilter(g, g5);
28+
figure, imshow(gg5);
29+
30+
b5= fspecial('average', [5 5]);
31+
bb5= imfilter(b, b5);
32+
figure, imshow(bb5);
33+
34+
rgb= cat(3, rr5, gg5, bb5);
35+
figure, imshow(rgb);
36+
37+
i5= fspecial('average', [5 5]);
38+
ii5= imfilter(i, i5);
39+
figure, imshow(ii5);
40+
41+
42+
Hrgb= cat(3, h, s, ii5);
43+
figure, imshow(Hrgb);
44+
45+
hsiZ= hsi2rgb(Hrgb);
46+
figure, imshow(hsiZ);
47+
48+
49+
rgb= tofloat(rgb);
50+
hsiZ= tofloat(hsiZ);
51+
s= rgb - hsiZ;
52+
figure, imshow(imcomplement(s), []);
53+
54+
t= -5:5;
55+
y= (1/k)*sin(k)
56+
57+

0 commit comments

Comments
 (0)