-
Notifications
You must be signed in to change notification settings - Fork 3
/
main_blender.cpp
156 lines (134 loc) · 6.59 KB
/
main_blender.cpp
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
146
147
148
149
150
151
152
153
154
155
156
#include "slBenchmark.h"
// Implementations
#include "BinaryImplementation.h"
#include "GrayCodedBinaryImplementation.h"
#include "PSMImplementation.h"
#include "DeBruijnImplementation.h"
#include "RaycastImplementation.h"
#include "SingleLineImplementation.h"
//Infrastructures
#include "slFileInfrastructure.h"
/**
* Below is an example of the file infrasructure. For it to work, it is expected that
* the folders existingCapturesPSM and existingCapturesGRAY exist and contain the
* captures from previous experiments.
*/
int fileInfrastructureExample() {
/*
// Infrastructures (one set of files per infrastructure)
slFileInfrastructure fileInfrastructurePhaseShift("SampleFiles/PhaseShift/captures");
slFileInfrastructure fileInfrastructureBinary("SampleFiles/Binary/captures");
slFileInfrastructure fileInfrastructureGray("SampleFiles/GrayCode/captures");
slFileInfrastructure fileInfrastructureDeBruijn("SampleFiles/DeBruijn/captures");
// Implementations
BinaryImplementation binaryImplementation;
GrayCodedBinaryImplementation grayCodedBinaryImplementation;
PSMImplementation psmImplementation;
DeBruijnImplementation deBruijnImplementation;
// Experiments
slSpeedDepthExperiment experiment1(&fileInfrastructureBinary, &binaryImplementation);
slSpeedDepthExperiment experiment2(&fileInfrastructureGray, &grayCodedBinaryImplementation);
slSpeedDepthExperiment experiment3(&fileInfrastructurePhaseShift, &psmImplementation);
slSpeedDepthExperiment experiment4(&fileInfrastructureDeBruijn, &deBruijnImplementation);
experiment1.run();
experiment2.run();
experiment3.run();
experiment4.run();
slSpeedBenchmark speedBenchmark;
speedBenchmark.addExperiment(&experiment1);
speedBenchmark.addExperiment(&experiment2);
speedBenchmark.addExperiment(&experiment3);
speedBenchmark.addExperiment(&experiment4);
speedBenchmark.compareExperiments();
*/
return 0;
}
/**
* An example of the Blender infrastructure example, where we run each
* implementation on the scene. It is expected that the scene is given in the
* appropriate blender file slVirtualScene.json.
*/
int blenderInfrastructureExample() {
double hFOV = DEFAULT_CAMERA_PROJECTOR_HORIZONTAL_FOV;
double vFOV = DEFAULT_CAMERA_PROJECTOR_VERTICAL_FOV;
slBlenderVirtualInfrastructure blenderVirtualInfrastructure;
// slPhysicalInfrastructure physicalInfrastructure(Size(1024, 768));
// slFileInfrastructure fileInfrastructure("30_60_fov_45", 30, 17.142, 60, 35.983, 1);
slFileInfrastructure fileInfrastructureSingleLine("default_fov_sphere_cube_singleline", hFOV, vFOV, hFOV, vFOV, 1);
slFileInfrastructure fileInfrastructureBinary("default_fov_sphere_cube_binary", hFOV, vFOV, hFOV, vFOV, 1);
// slFileInfrastructure fileInfrastructureBinary("default_fov_plane_binary", hFOV, vFOV, hFOV, vFOV, 1);
// slFileInfrastructure fileInfrastructureBinary("default_fov_sphere_cube_binary_2048x1080", hFOV, vFOV, hFOV, vFOV, 1);
slFileInfrastructure fileInfrastructureGrayCoded("default_fov_sphere_cube_graycoded", hFOV, vFOV, hFOV, vFOV, 1);
slFileInfrastructure fileInfrastructureDeBruijn("default_fov_sphere_cube_debruijn", hFOV, vFOV, hFOV, vFOV, 1);
// slFileInfrastructure fileInfrastructurePSM("default_fov_sphere_cube_psm", hFOV, vFOV, hFOV, vFOV, 1);
// slFileInfrastructure fileInfrastructurePSM("default_fov_plane_psm", hFOV, vFOV, hFOV, vFOV, 1);
/*
blenderVirtualInfrastructure.setCameraHorizontalFOV(30);
blenderVirtualInfrastructure.setCameraVerticalFOV(17.142);
blenderVirtualInfrastructure.setProjectorHorizontalFOV(60);
blenderVirtualInfrastructure.setProjectorVerticalFOV(35.983);
*/
/*
blenderVirtualInfrastructure.setCameraResolution(Size(2048, 1080));
blenderVirtualInfrastructure.setProjectorResolution(Size(2048, 1080));
fileInfrastructureBinary.setCameraResolution(Size(2048, 1080));
fileInfrastructureBinary.setProjectorResolution(Size(2048, 1080));
*/
BinaryImplementation binaryImplementation(128);
GrayCodedBinaryImplementation grayCodedBinaryImplementation(128);
// PSMImplementation psmImplementation;
DeBruijnImplementation deBruijnImplementation(128);
RaycastImplementation raycastImplementation(1920);
SingleLineImplementation singleLineImplementation(1920);
// RaycastImplementation raycastImplementation(2048);
// SingleLineImplementation singleLineImplementation(2048);
// slSpeedDepthExperiment experiment1(&blenderVirtualInfrastructure, &binaryImplementation);
slSpeedDepthExperiment experiment1(&fileInfrastructureBinary, &binaryImplementation);
// slSpeedDepthExperiment experiment2(&blenderVirtualInfrastructure, &grayCodedBinaryImplementation);
slSpeedDepthExperiment experiment2(&fileInfrastructureGrayCoded, &grayCodedBinaryImplementation);
// slSpeedDepthExperiment experiment3(&blenderVirtualInfrastructure, &psmImplementation);
// slSpeedDepthExperiment experiment3(&fileInfrastructurePSM, &psmImplementation);
// slSpeedDepthExperiment experiment4(&blenderVirtualInfrastructure, &deBruijnImplementation);
slSpeedDepthExperiment experiment4(&fileInfrastructureDeBruijn, &deBruijnImplementation);
// slSpeedDepthExperiment experiment5(&physicalInfrastructure, &deBruijnImplementation);
// slSpeedDepthExperiment experiment5(&physicalInfrastructure, &binaryImplementation);
// slSpeedDepthExperiment experiment6(&fileInfrastructure, &deBruijnImplementation);
//
slSpeedDepthExperiment experiment7(&blenderVirtualInfrastructure, &raycastImplementation);
// slSpeedDepthExperiment experiment8(&blenderVirtualInfrastructure, &singleLineImplementation);
slSpeedDepthExperiment experiment8(&fileInfrastructureSingleLine, &singleLineImplementation);
experiment1.run();
experiment2.run();
// experiment3.run();
// experiment4.run();
// experiment5.run();
// experiment6.run();
// experiment7.run();
// experiment8.run();
/*
slBenchmark benchmark(&experiment7);
benchmark.addExperiment(&experiment1);
benchmark.addExperiment(&experiment2);
// benchmark.addExperiment(&experiment3);
benchmark.addExperiment(&experiment4);
// benchmark.addExperiment(&experiment5);
// benchmark.addExperiment(&experiment6);
benchmark.addExperiment(&experiment8);
benchmark.addMetric(new slSpeedMetric());
benchmark.addMetric(new slAccuracyMetric());
benchmark.addMetric(new slResolutionMetric());
benchmark.compareExperiments();
*/
sl3DReconstructor::writeXYZPointCloud(&experiment1);
sl3DReconstructor::writeXYZPointCloud(&experiment2);
// sl3DReconstructor::writeXYZPointCloud(&experiment3);
// sl3DReconstructor::writeXYZPointCloud(&experiment4);
// sl3DReconstructor::writeXYZPointCloud(&experiment7);
// sl3DReconstructor::writeXYZPointCloud(&experiment8);
return 0;
}
int main()
{
// return fileInfrastructureExample();
return blenderInfrastructureExample();
}