-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDEMO_Video.m
61 lines (46 loc) · 1.58 KB
/
DEMO_Video.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
clear; clc;
run_path;
load('X_Lobby.mat');
%% Parameters
Rank = 5; % the estimated low-rank
disp(' start ... !')
t_start = tic;
[video_fg,video_bg,video_matrix] = Video_BGFG_Separation(X_video,Rank);
t_end = toc(t_start);
fprintf(' run time: %f (s) \n',t_end)
t = 363;
I_t = X_video(:,:,t);
BG = video_bg(:,t); BG = reshape(BG,size(I_t));
FG = video_fg(:,t); FG = reshape(FG,size(I_t));
fig = figure;
subplot(131); imagesc(I_t); axis off; colormap gray;
title('Original Frame')
subplot(132); imagesc(BG); axis off; colormap gray;
title('Background')
subplot(133); imagesc((FG)); axis off; colormap gray;
title('Foreground')
set(fig, 'units', 'inches', 'position', [0.2 0.5 13 6]);
t = 641;
I_t = X_video(:,:,t);
BG = video_bg(:,t); BG = reshape(BG,size(I_t));
FG = video_fg(:,t); FG = reshape(FG,size(I_t));
fig = figure;
subplot(131); imagesc(I_t); axis off; colormap gray;
title('Original Frame')
subplot(132); imagesc(BG); axis off; colormap gray;
title('Background')
subplot(133); imagesc((FG)); axis off; colormap gray;
title('Foreground')
set(fig, 'units', 'inches', 'position', [0.2 0.5 13 6]);
t = 1246;
I_t = X_video(:,:,t);
BG = video_bg(:,t); BG = reshape(BG,size(I_t));
FG = video_fg(:,t); FG = reshape(FG,size(I_t));
fig = figure;
subplot(131); imagesc(I_t); axis off; colormap gray;
title('Original Frame')
subplot(132); imagesc(BG); axis off; colormap gray;
title('Background')
subplot(133); imagesc((FG)); axis off; colormap gray;
title('Foreground')
set(fig, 'units', 'inches', 'position', [0.2 0.5 13 6]);