-
Notifications
You must be signed in to change notification settings - Fork 62
/
KittiConfig.cpp
109 lines (93 loc) · 3.11 KB
/
KittiConfig.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
/*
Copyright 2016 Mark Muth
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "KittiConfig.h"
#include <string>
#include <vector>
#include <iostream>
#include <boost/filesystem/path.hpp>
#include <boost/format.hpp>
std::string KittiConfig::data_directory = "../KittiData";
std::string KittiConfig::raw_data_directory = "raw";
std::string KittiConfig::dataset_folder_template = "%|04|_sync";
std::string KittiConfig::point_cloud_directory = "velodyne_points/data";
std::string KittiConfig::point_cloud_file_template = "%|010|.bin";
std::string KittiConfig::tracklets_directory = ".";
std::string KittiConfig::tracklets_file_name = "tracklet_labels.xml";
const std::vector<int> KittiConfig::availableDatasets = KittiConfig::initAvailableDatasets();
boost::filesystem::path KittiConfig::getPointCloudPath(int dataset)
{
return boost::filesystem::path(data_directory)
/ raw_data_directory
/ (boost::format(dataset_folder_template) % dataset).str()
/ point_cloud_directory
;
}
boost::filesystem::path KittiConfig::getPointCloudPath(int dataset, int frameId)
{
return getPointCloudPath(dataset)
/ (boost::format(point_cloud_file_template) % frameId).str()
;
}
boost::filesystem::path KittiConfig::getTrackletsPath(int dataset)
{
return boost::filesystem::path(data_directory)
/ raw_data_directory
/ (boost::format(dataset_folder_template) % dataset).str()
/ tracklets_directory
/ tracklets_file_name
;
}
int KittiConfig::getDatasetNumber(int index)
{
if (index >= 0 && index < availableDatasets.size())
{
return availableDatasets.at(index);
}
std::cerr << "No such data set index: " << index << std::endl;
return 0;
}
int KittiConfig::getDatasetIndex(int number)
{
for (int i = 0; i < availableDatasets.size(); ++i)
{
if (availableDatasets.at(i) == number)
{
return i;
}
}
std::cerr << "No such data set number: " << number << std::endl;
return 0;
}
std::vector<int> KittiConfig::initAvailableDatasets()
{
std::vector<int> datasets;
datasets.push_back(1);
datasets.push_back(2);
datasets.push_back(5);
datasets.push_back(9);
datasets.push_back(11);
datasets.push_back(13);
datasets.push_back(14);
datasets.push_back(17);
datasets.push_back(18);
datasets.push_back(48);
datasets.push_back(51);
datasets.push_back(56);
datasets.push_back(57);
datasets.push_back(59);
datasets.push_back(60);
datasets.push_back(84);
datasets.push_back(91);
datasets.push_back(93);
return datasets;
}