Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1. a. >> f1=fspecial('gaussian',[5,5],1);
>> figure,surf(1:5,1:5,f1)
0.2
0.15
0.1
0.05
0
5
4 5
3 4
3
2 2
1 1
b. >> f2=fspecial('gaussian',[7,7],2);
>> figure,surf(1:7,1:7,f2),axis tight
0.04
0.03
0.02
0.01
6
7
6
4 5
4
2 3
2
1
49385002 資工三陳俊志
c. >> f3=fspecial('gaussian',[9,9],3);
>> figure,surf(1:9,1:9,f3),axis tight
0.02
0.015
0.01
0.005
8
6 8
6
4
4
2 2
49385002 資工三陳俊志
9x9 withσ=3: >> figure,imshow(filter2(f3,camera)/256)
3. a.>> log1=fspecial('log',[5,5]);
>> figure,surf(1:5,1:5,log1),axis tight
49385002 資工三陳俊志
0
1
2
3
4
5
4 5
3 4
3
2 2
1 1
b. >>log2=fspecial('log',[7,7],1);
>> figure,surf(1:7,1:7,log2),axis tight
0.05
0.1
0.15
0.2
0.25
0.3
6
7
6
4 5
4
2 3
2
1
49385002 資工三陳俊志
7x7 withσ=1: >> figure,imshow(mat2gray(filter2(log2,camera))/2)
5. a. >> u1=fspecial('unsharp');
>> figure,imshow(filter2(u1,camera)/255)
49385002 資工三陳俊志
b. >> u2=fspecial('unsharp',0.5);
>> figure,imshow(filter2(u2,camera)/255)
c. >> u3=fspecial('unsharp',1.0);
>> figure,imshow(filter2(u3,camera)/255)
49385002 資工三陳俊志
6. Using imresize:
‘nearest’: >>head1=imresize(head,4);
>>imshow(head1)
49385002 資工三陳俊志
‘bilinear’: >> head2=imresize(head,4,'bilinear');
>> imshow(head2)
49385002 資工三陳俊志
‘bicubic’: >> head3=imresize(head,4,'bicubic');
>> imshow(head3)
49385002 資工三陳俊志
Using the zero interleave method:
‘nearest’: >> headz=zeroint(zeroint(head));
>> imshow(filter2([1 1 0;1 1 0;0 0 0],headz)/255)
49385002 資工三陳俊志
‘bilinear’: >> imshow(filter2([1 2 1;2 4 2;1 2 1]/4,headz)/255)
49385002 資工三陳俊志
‘bicubic’: >> bicub=[1 4 6 4 1;4 16 24 16 4;6 24 36 24 6;4 16 24 16 4;1 4 6 4 1]/64;
>> imshow(filter2(bicub,headz)/255)
49385002 資工三陳俊志
Conclusion: To make the resulting image four times as big as the original, the latter
method will cause the black dots to appear in the images. Judging from the results, I think
the former method is obviously better.
49385002 資工三陳俊志