-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdownsc1.m
46 lines (31 loc) · 1.08 KB
/
downsc1.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
clc
clear all
close all
Img1=imread('barbara.bmp');
figure,imshow(Img1),title('Original')
[Height, Width, Depth]=size(Img1);
if Depth==1
Img2=Img1
else
Img2=Img1(:,:,:);
end
M=4;
Img3=Img2(1:M:Height,1:M:Width,1:Depth);
% figure,imshow(Img3),title('No prefiltering')
Img4=imresize(Img3,[Height,Width],'bicubic');
% figure,imshow(Img4),title('Downsample, no prefiltering')
% APPLYING GAUSSIAN FILTERING
Img5=imfilter(Img2,fspecial('gaussian',[4,4],1),'symmetric','replicate','conv');
Img6=Img5(1:M:Height,1:M:Width,1:Depth);
% figure, imshow(Img6),title('After prefiltering')
Img7=imresize(Img6,[Height,Width],'bicubic');
% figure, imshow(Img7),title('After prefiltering-Upscaled')
% USING LANCZOS FILTERING
Img8=imresize(Img3,1,'lanczos3');
% figure, imshow(Img8),title('After LANCZOS-Upscaled')
% RESAMPLING AFTER LANCZOS USING SPLINE
nimg = imresample([4,4],Im2double(Img8),[1,1],'spline');
figure, imshow(nimg),title('After LANCZOS-Upscaled')
% RESAMPLING USING BICIBIC
Img9=imresize(Img8,[Height,Width],'bicubic');
figure, imshow(Img9),title('After lanczos-bicubic-Upscaled')