-
Notifications
You must be signed in to change notification settings - Fork 0
/
LargeScaleTesting.m
89 lines (76 loc) · 1.98 KB
/
LargeScaleTesting.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
% Photogrammetry Script
% close all
clear
clc
%%
tic
planesModel = LoadPlanesFromFile('kuukpak planar model.txt');
points = samplePlanesMulti(planesModel, 2000);
radInc = 360/20;
rads = [0: radInc : 360-radInc]';
camX = cosd(rads)*12;
camY = sind(rads)*12;
camZ = ones(size(camX));
camPos = [camX, camY+3,camZ+1];
fig = 0;
if fig
figure, hold on
for i = 1:length(points)
plot3(points(i).xyz(1,1),points(i).xyz(1,2),points(i).xyz(1,3),'.')
end
axis equal
end
angles = zeros(size(rads,1),3);
for i = 1:length(angles)
Zvec = [camX(i), camY(i), camZ(i)+3]';
Zvec = Zvec/ sqrt(sum(Zvec.^2));
Xvec = [-Zvec(2), Zvec(1), 0]';
Xvec = Xvec/ sqrt(sum(Xvec.^2));
Yvec = cross(Zvec, Xvec);
R = [Xvec, Yvec, Zvec]';
angles(i,:) = [atan2d(-R(3,2),R(3,3)),asind(R(3,1)),atan2d(-R(2,1), R(1,1))];
if fig
plot3(camPos(i,1),camPos(i,2),camPos(i,3),'.r')
quiver3(camPos(i,1),camPos(i,2),camPos(i,3),Zvec(1),Zvec(2),Zvec(3),0,'b')
quiver3(camPos(i,1),camPos(i,2),camPos(i,3),Xvec(1),Xvec(2),Xvec(3),0,'r')
quiver3(camPos(i,1),camPos(i,2),camPos(i,3),Yvec(1),Yvec(2),Yvec(3),0,'g')
end
end
toc
%%
tic
for i = 1:length(rads)
I(i) = ImageClass(camPos(i,:),angles(i,:),Camera());
end
toc
%%
tic
for i = 1:length(I)
I(i).imageData = I(i).observePoints(points);
end
toc
%%
if 0
for i = 1:10:length(I)
figure, hold on
for j = 1:length(I(i).imageData)
if ~isempty(I(i).imageData(1).coords)
plot(I(i).imageData(j).coords(1),I(i).imageData(j).coords(2),'.');
end
end
set(gca,'xlim',[-I(1).camera.sensorSize(1)/2,I(1).camera.sensorSize(1)/2]);
set(gca,'ylim',[-I(1).camera.sensorSize(2)/2,I(1).camera.sensorSize(2)/2]);
title(['Image ', num2str(i)]);
end
end
% toc
%%
tic
I = reducePointObs(I,points);
toc
%%
tic
createFEMBUNfiles('LargeTest2000fix',I,points);
createFEMBUNfilesFN('LargeTest2000Err5cm',I,points);
toc
fclose('all');