-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrasl_plot_color.m
117 lines (107 loc) · 4.09 KB
/
rasl_plot_color.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
function rasl_plot_color(numImage, canonicalImageSize, layout, Fotr, Tr, Rr)
%% display
% 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, 3);
% white edges
bigpic = cell(xI,yI); % (xI*canonicalImageSize(1),yI*canonicalImageSize(2));
% 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, 3);
else
tmp = reshape(Fotr(:,yI*(i-1)+j), canonicalImageSize);
for k = 1:3
container ((gap2+1):(end-gap2), (gap2+1):(end-gap2), k) = tmp(:, :, k);
end
bigpic{i,j} = uint8(container);
end
end
end
figure
imshow(cell2mat(bigpic),[],'DisplayRange',[0 max(max(Fotr))],'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, 3);
else
tmp = reshape(Tr(:,yI*(i-1)+j), canonicalImageSize);
for k = 1:3
container ((gap2+1):(end-gap2), (gap2+1):(end-gap2), k) = tmp(:, :, k);
end
bigpic{i,j} = uint8(container);
c_img = mapminmax(Tr(:,yI*(i-1)+j)', 0, 1)';
% imwrite(uint8(reshape(c_img, canonicalImageSize)*255), ['./results/video_11/align_input/ch_3/vd_11_input_align_' num2str(yI*(i-1)+j+82) '.bmp']);
end
end
end
figure
imshow(cell2mat(bigpic),[],'DisplayRange',[0 max(max(Tr))],'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, 3);
else
tmp = reshape(Rr(:,yI*(i-1)+j), canonicalImageSize);
for k = 1:3
container ((gap2+1):(end-gap2), (gap2+1):(end-gap2), k) = tmp(:, :, k);
end
bigpic{i,j} = uint8(container);
c_img = mapminmax(Rr(:,yI*(i-1)+j)', 0, 1)';
%imwrite(uint8(reshape(c_img, canonicalImageSize)*255), ['./results/video_11/align_output/ch_1/vd_11_input_align_' num2str(yI*(i-1)+j+82) '.bmp']);
end
end
end
figure
imshow(cell2mat(bigpic),[],'DisplayRange',[0 max(max(Rr))],'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;
% c_img = mapminmax(abs(E(:,yI*(i-1)+j)'), 0, 1)';
% % imwrite(uint8(reshape(c_img, canonicalImageSize)*255), ['./results/video_11/error/ch_3/vd_11_error_' num2str(yI*(i-1)+j+82) '.bmp']);
% end
% end
% end
% figure
% imshow(abs(cell2mat(bigpic)),[],'DisplayRange',[0 max(max(abs(E)))],'Border','tight')
% title('Sparse corruptions in the aligned images') ;
% average face of D, Do and A
% bigpic = cell(1,3);
% container ((gap2+1):(end-gap2), (gap2+1):(end-gap2)) = reshape(sum(D,2), canonicalImageSize);
% bigpic{1,1} = container;
% container ((gap2+1):(end-gap2), (gap2+1):(end-gap2)) = reshape(sum(Do,2), canonicalImageSize);
% bigpic{1,2} = container;
% container ((gap2+1):(end-gap2), (gap2+1):(end-gap2)) = reshape(sum(A,2), canonicalImageSize);
% bigpic{1,3} = container;
%
% figure
% subplot(1,3,1)
% imshow(uint8(reshape(sum(Fotr,3), canonicalImageSize)),[])
% title('average of unaligned D')
% subplot(1,3,2)
% imshow(uint8(reshape(sum(Tr,3), canonicalImageSize)),[])
% title('average of aligned D')
% subplot(1,3,3)
% imshow(uint8(reshape(sum(Rr,3), canonicalImageSize)),[])
% title('average of A')