-
Notifications
You must be signed in to change notification settings - Fork 1
/
rasl_plot.m
94 lines (84 loc) · 2.7 KB
/
rasl_plot.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
function rasl_plot(destDir, numImage, canonicalImageSize, layout)
load(fullfile(destDir, 'original.mat'), 'D') ;
load(fullfile(destDir, 'final.mat'), 'Do','A','E') ;
% layout
if nargin < 4
xI = ceil(sqrt(numImage)) ;
yI = ceil(numImage/xI) ;
gap = 2;
gap2 = 1; % gap2 = gap/2;
else
xI = layout.xI ;
yI = layout.yI ;
gap = layout.gap ;
gap2 = layout.gap2 ; % gap2 = gap/2;
end
container = ones(canonicalImageSize(1)+gap, canonicalImageSize(2)+gap);
% white edges
bigpic = cell(xI,yI);
% D
for i = 1:xI
for j = 1:yI
if yI*(i-1)+j > numImage
bigpic{i,j} = ones(canonicalImageSize(1)+gap, canonicalImageSize(2)+gap);
else
container ((gap2+1):(end-gap2), (gap2+1):(end-gap2)) = reshape(D(:,yI*(i-1)+j), canonicalImageSize);
bigpic{i,j} = container;
end
end
end
figure
imshow(cell2mat(bigpic),[],'DisplayRange',[0 max(max(D))],'Border','tight')
title('Input images') ;
% Do
for i = 1:xI
for j = 1:yI
if yI*(i-1)+j > numImage
bigpic{i,j} = ones(canonicalImageSize(1)+gap, canonicalImageSize(2)+gap);
else
container ((gap2+1):(end-gap2), (gap2+1):(end-gap2)) = reshape(Do(:,yI*(i-1)+j), canonicalImageSize);
bigpic{i,j} = container;
end
end
end
figure
imshow(cell2mat(bigpic),[],'DisplayRange',[0 max(max(Do))],'Border','tight')
title('Aligned images') ;
% A
for i = 1:xI
for j = 1:yI
if yI*(i-1)+j > numImage
bigpic{i,j} = ones(canonicalImageSize(1)+gap, canonicalImageSize(2)+gap);
else
container ((gap2+1):(end-gap2), (gap2+1):(end-gap2)) = reshape(A(:,yI*(i-1)+j), canonicalImageSize);
bigpic{i,j} = container;
end
end
end
figure
imshow(cell2mat(bigpic),[],'DisplayRange',[0 max(max(A))],'Border','tight')
title('Aligned images adjusted for sparse errors') ;
% E
for i = 1:xI
for j = 1:yI
if yI*(i-1)+j > numImage
bigpic{i,j} = ones(canonicalImageSize(1)+gap, canonicalImageSize(2)+gap);
else
container ((gap2+1):(end-gap2), (gap2+1):(end-gap2)) = reshape(E(:,yI*(i-1)+j), canonicalImageSize);
bigpic{i,j} = container;
end
end
end
figure
imshow(abs(cell2mat(bigpic)),[],'DisplayRange',[0 max(max(abs(E)))],'Border','tight')
title('Sparse corruptions in the aligned images') ;
figure
subplot(1,3,1)
imshow(reshape(sum(D,2), canonicalImageSize),[])
title('average of unaligned D')
subplot(1,3,2)
imshow(reshape(sum(Do,2), canonicalImageSize),[])
title('average of aligned D')
subplot(1,3,3)
imshow(reshape(sum(A,2), canonicalImageSize),[])
title('average of A')