-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.cpp
65 lines (54 loc) · 1.54 KB
/
main.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
#include <fstream>
#include <vector>
#include <sstream>
#include <iostream>
#include "base.h"
#include "SysParams.h"
#include "Camera.h"
using namespace std;
void loadImage(const string strAssociationFilename, vector<double>& vdTimestamps,
vector<string>& vstrFilenamesRGB, vector<string>& vstrFilenamesDepth)
{
ifstream fin(strAssociationFilename);
while(!fin.eof())
{
string s;
getline(fin,s);
if(!s.empty())
{
stringstream ss(s.c_str());
double t;
string sRgb, sDepth;
ss>>t;
vdTimestamps.push_back(t);
ss>>sRgb>>t>>sDepth;
vstrFilenamesRGB.push_back(sRgb);
vstrFilenamesDepth.push_back(sDepth);
}
}
return;
}
int main(int argc, char** argv)
{
SysParams sysparams("/home/jpl/lines/f1.yaml");
Camera camera(sysparams);
string strAssociationFilename = "/home/jpl/lines/rgbd_dataset_freiburg1_xyz/associations.txt";
int nImages = 0;
vector<double> vdTimestamps;
vector<string> vstrFilenamesRGB;
vector<string> vstrFilenamesDepth;
//load the filename of rgb and depth
loadImage(strAssociationFilename,vdTimestamps, vstrFilenamesRGB, vstrFilenamesDepth);
nImages = vstrFilenamesRGB.size();
if(vstrFilenamesRGB.empty())return 0;
if(vstrFilenamesRGB.size()!=vstrFilenamesDepth.size())return 0;
//load image
cv::Mat imRGB, imDepth;
for(int i=0 ;i<nImages; i++)
{
imRGB = cv::imread(vstrFilenamesRGB[i]);
imDepth = cv::imread(vstrFilenamesDepth[i]);
double tstamp = vdTimestamps[i];
}
return 0;
}