-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo_NWSR_1xInterp.asv
61 lines (60 loc) · 2.2 KB
/
demo_NWSR_1xInterp.asv
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
53
54
55
56
57
58
59
60
61
%%
testImg_indices=1:18;
scale_factor=1;
experiment_name='NWSR_1xInterp'
%
addpath('E:\mfiles_acode_thesis\005_ksvd\Kafieh_OCT_Denoising\ompbox10_OCT');
addpath('E:\mfiles_acode_thesis\005_ksvd\Kafieh_OCT_Denoising\ksvdbox13_OCT');
addpath('E:\THESIS\Implements\BM3D'); % if BM3D is used
addpath('E:\mfiles_acode_thesis\SBSDI_2013_Fang_2');% if patchfiltering or if BM3D (it needs function_stdEst) is used
addpath('E:\THESIS\Implements\Pedagogical\ML');%euclid
addpath('E:\THESIS\Implements\Pedagogical');
addpath(genpath('E:\mfiles_acode_thesis\Inpaint_nans\'));
%
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=['E:\DTSET\Fang2013\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
tic
[im_out,time_end]=main_reconstruct_oct_image(imn,...
scale_factor,ps,psnlm,dlfile,NUM,NUM_neighbors);
time_end=
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'];