-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpyr.m
65 lines (45 loc) · 1.48 KB
/
gpyr.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
%
% Spatial Filtering: Gaussian blur and down sample
% Temporal Filtering: Ideal bandpass
%
alpha = 50;
level = 1;
% compute Gaussian blur stack
disp('Spatial filtering...')
Gdown_stack = build_GDown_stack(points(:, :, :), level);
disp('Finished')
% Temporal filtering
disp('Temporal filtering...')
filtered_stack = ideal_bandpassing(Gdown_stack, 1, 1.5, 3, 204);
disp('Finished')
%% amplify
filtered_stack(:,:,:,1) = filtered_stack(:,:,:,1) .* alpha;
filtered_stack(:,:,:,2) = filtered_stack(:,:,:,2) .* alpha;
%% Render on the input video
disp('Rendering...')
index = 1;
maxLim = max(max(max(filtered_stack(:,:,:,index))));
minLim = min(min(min(filtered_stack(:,:,:,index))));
minLim = 0;
lim = [minLim maxLim]
% output video
imgSize = [111 111];
k = 0;
for i=1:size(points, 1)
k = k+1;
img1 = reshape(points(i, 3, :), imgSize);
filtered = squeeze(filtered_stack(k,:,:,1));
filtered = imresize(filtered,imgSize);
%filtered = filtered+img1;
%filtered = filtered(50-15:50+20, 50-10:50+20);
%minPositive = min(min(filtered(filtered > 0)));
%filtered(filtered == 0) = minPositive;
%filtered(filtered < 0) = 0;
imagesc(filtered);
caxis(lim);
title(['Frame ' int2str(i) ])
%colorbar
drawnow;
pause(0.02);
end
disp('Finished')