-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo_NWSR_1xInterp.m
52 lines (50 loc) · 1.69 KB
/
demo_NWSR_1xInterp.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
%%
testImg_indices=1:18;
scale_factor=1;
experiment_name='NWSR_1xInterp'
%
NN=length(testImg_indices);% number of test images
%
% pre-allocating memory for creating a table of measures.
qm_data=zeros(NN,2);% #images by #quality measures & time
row_name=cell(NN,1);
%
for i=11
strnumber=num2str(testImg_indices(i));
fprintf('image #%s\n',strnumber)
pth=['./datasets/For synthetic experiments/',strnumber];
% ** Load a test and its HH image
testfile='test.tif';
cleanfile='average.tif';
imn = single(imread(fullfile(pth,testfile)));
im= single(imread(fullfile(pth,cleanfile)));
% the outputs are saved as images in the following folder
outfolder=['outs/' experiment_name];
if ~exist(outfolder,'dir')
mkdir(outfolder);
end
outfname=[outfolder '/' strnumber];% output file name
%
ps=[8 8]; % patch size for sparse representation
psnlm=[6 6];% patch size for NLM filtering
dlfile='dictionary_8x8_20it_rand_g165'; % dictionary file name
NUM=6;
NUM_neighbors=15;
% run the algorithm
[im_out,time_end]=main_reconstruct_oct_image(imn,...
scale_factor,ps,psnlm,dlfile,NUM,NUM_neighbors);
PSNR=comp_psnr(im,im_out);
qm_data(i,:)=[PSNR,time_end];
row_name{i}=strnumber;
%
imwrite(im2uint8(im_out/255),[outfname '.tif'],'tif');
end
% Draw a table
f=figure;
colname={'PSNR','TIME'};
colformat=repmat({'short g'},1,numel(colname));
t = uitable('Parent', f,'Data', qm_data,'RowName',row_name,...
'ColumnName', colname,'ColumnFormat', colformat,...
'Units','normalized','Position',[0 0 1 1]);
t.FontSize=12;
f.Name=[ experiment_name ' - 18 foveal images'];