-
Notifications
You must be signed in to change notification settings - Fork 1
/
ModCircleCapture.m
146 lines (122 loc) · 4.27 KB
/
ModCircleCapture.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
function ModCircleCapture( hFig, hAxes )
%CircleCapture: Spin the target in a circle taking pictures
FrameNumber = 0;
NumFrames = 360;
tilt = 0;
angle = 0;
step = 1;
%Figure out where the camera should be when circling the target
view(0,90);
camva('auto');
view(0,90);
drawnow
TopViewAngle = camva;
view(0,0);
drawnow
MidViewAngle = camva / 3;
BotViewAngle = MidViewAngle / 3;
startAngle = 0;
endAngle = 90;
startTilt = 90;
endTilt = -90;
step = -1;
tilts = 90:step:-90;
camViewingAngles = [];
if(TopViewAngle ~= MidViewAngle)
%camViewingAngles = [TopViewAngle:(MidViewAngle-TopViewAngle)/((NumFrames/2)-1):MidViewAngle MidViewAngle:-(MidViewAngle-TopViewAngle)/((NumFrames/2)-1):TopViewAngle];
camViewingAngles = [TopViewAngle:(MidViewAngle-TopViewAngle)/((NumFrames/2)-1):MidViewAngle MidViewAngle:(BotViewAngle-MidViewAngle)/((NumFrames/2)-1):BotViewAngle];
else
camViewingAngles = repmat(TopViewAngle, 1, NumFrames-1);
end
camAngles = [];
if(startAngle ~= endAngle)
camAngles = startAngle:(endAngle-startAngle)/(length(camViewingAngles)-1):endAngle;
else
camAngles = repmat(startAngle, 1, length(camViewingAngles)-1);
end
camTilts = [];
if(startTilt ~= endTilt)
%camTilts = [startTilt:(endTilt-startTilt)/((NumFrames/2)-1):endTilt endTilt:-(endTilt-startTilt)/((NumFrames/2)-1):startTilt];
camTilts = [startTilt:(endTilt-startTilt)/(length(camViewingAngles)-1):endTilt];
else
camTilts = repmat(startTilt, 1, length(camViewingAngles)-1);
end
for(i = 1:length(camTilts))
camva(camViewingAngles(i));
view(camAngles(i), camTilts(i));
drawnow;
f = getframe(hFig); %Capture screen shot
[im,map] = frame2im(f); %Return associated image data
if isempty(map) %Truecolor system
rgb = im;
else %Indexed system
rgb = ind2rgb(im,map); %Convert image data
end
imwrite(rgb, ['Frame_' num2str(FrameNumber) '.png']);
FrameNumber = FrameNumber +1;
end
%startVA =
%
% for(i = 1:length(tilts))
% f = getframe(hFig); %Capture screen shot
% [im,map] = frame2im(f); %Return associated image data
% if isempty(map) %Truecolor system
% rgb = im;
% else %Indexed system
% rgb = ind2rgb(im,map); %Convert image data
% end
%
% imwrite(rgb, ['Frame_' num2str(FrameNumber) '.png']);
% FrameNumber = FrameNumber +1;
% tilt = tilts(i);
% camva(camAngles(i));
% view(0,tilt);
%
% camorbit(hAxes, 0, step);
% % drawnow
% end
%
%
% camva(XYva); %Fix the camera at a set distance
%
% step = 1;
% angle = 0;
% while(angle < 360)
% f = getframe(hFig); %Capture screen shot
% [im,map] = frame2im(f); %Return associated image data
% if isempty(map) %Truecolor system
% rgb = im;
% else %Indexed system
% rgb = ind2rgb(im,map); %Convert image data
% end
%
% imwrite(rgb, ['Frame_' num2str(FrameNumber) '.png']);
% FrameNumber = FrameNumber +1;
% angle = angle + step;
% view(angle,tilt);
% camorbit(hAxes, step, 0);
% % drawnow
% end
%
% for(i = length(tilts):-1:1)
% f = getframe(hFig); %Capture screen shot
% [im,map] = frame2im(f); %Return associated image data
% if isempty(map) %Truecolor system
% rgb = im;
% else %Indexed system
% rgb = ind2rgb(im,map); %Convert image data
% end
%
% imwrite(rgb, ['Frame_' num2str(FrameNumber) '.png']);
% FrameNumber = FrameNumber +1;
% angle = angle + step;
%
% tilt = tilts(i);
% camva(camAngles(i));
%
% % camva(camAngles(i));
% view(0,tilt);
% end
%Camera Position: [940000 -757182 803840]
%Camera Target: [128925 143675 13815]
end