-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathanimateLightField.m
executable file
·45 lines (30 loc) · 1.05 KB
/
animateLightField.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
lightFieldResolution = size(lightField);
% indices for animation
centerY = round(lightFieldResolution(1)/2);
indicesY = centerY:-1:1;
indicesY = [indicesY 2:lightFieldResolution(1)];
indicesY = [indicesY lightFieldResolution(1)-1:-1:centerY];
centerX = round(lightFieldResolution(2)/2);
indicesX = centerX:-1:1;
indicesX = [indicesX 2:lightFieldResolution(2)];
indicesX = [indicesX lightFieldResolution(2)-1:-1:centerX];
numColorChannels = 1;
if numel(lightFieldResolution) > 4
numColorChannels = lightFieldResolution(5);
end
frameCount = 1;
pauseTime = 0.1;
for kx=indicesX
I = reshape(lightField(centerY,kx,:,:,:), [lightFieldResolution(3) lightFieldResolution(4) numColorChannels]);
imshow(I);
drawnow;
pause(pauseTime);
frameCount=frameCount+1;
end
for ky=indicesY
I = reshape(lightField(ky,centerX,:,:,:), [lightFieldResolution(3) lightFieldResolution(4) numColorChannels]);
imshow( I );
drawnow;
pause(pauseTime);
frameCount=frameCount+1;
end