-
Notifications
You must be signed in to change notification settings - Fork 8
/
ReconstructionPipeline.cpp
49 lines (37 loc) · 1.29 KB
/
ReconstructionPipeline.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
#include <iostream> // for debugging messages
#include "ReconstructionPipeline.h"
#include "RGBDMerger1.h"
ReconstructionPipeline::ReconstructionPipeline(void)
{
this->estimator = new CDCDepthEstimator;
this->merger = new RGBDMerger1();
}
ReconstructionPipeline::~ReconstructionPipeline(void)
{
delete this->estimator;
delete this->merger;
}
void ReconstructionPipeline::reconstructScene(const vector<LightFieldPicture>&
lightfields)
{
int lfpCount = lightfields.size();
vector<Mat> depthMaps = vector<Mat>(lfpCount);
vector<Mat> confidenceMaps = vector<Mat>(lfpCount);
vector<Mat> aifImages = vector<Mat>(lfpCount);
//cout << "starting depth estimation" << endl;
// estimate depth,...
for (int i = 0; i < lfpCount; i++)
{
estimator->estimateDepth(lightfields.at(i));
depthMaps[i] = estimator->getDepthMap();
confidenceMaps[i] = estimator->getConfidenceMap();
aifImages[i] = estimator->getExtendedDepthOfFieldImage(); // implicite download?
}
//cout << "starting model fusion" << endl;
// merge partial reconstructions
const Mat calibrationMatrix = lightfields.at(0).getCalibrationMatrix();
merger->merge(aifImages, depthMaps, confidenceMaps, calibrationMatrix);
// get results from merger
this->pointCloud = merger->pointCloud;
this->pointColors = merger->pointColors;
}