| 139 | } |
| 140 | |
| 141 | std::vector<ImageSequence_withPlaneSeg::img_info> ImageSequence_withPlaneSeg::acquire_image_information(const std::string &seq_dir_path, |
| 142 | const std::string ×tamp_file_path) const |
| 143 | { |
| 144 | std::vector<ImageSequence_withPlaneSeg::img_info> img_infos; |
| 145 | |
| 146 | // load timestamps |
| 147 | std::ifstream ifs_timestamp; |
| 148 | ifs_timestamp.open(timestamp_file_path.c_str()); |
| 149 | if (!ifs_timestamp) |
| 150 | { |
| 151 | throw std::runtime_error("Could not load a timestamp file from " + timestamp_file_path); |
| 152 | } |
| 153 | |
| 154 | // load header row |
| 155 | std::string s; |
| 156 | getline(ifs_timestamp, s); |
| 157 | getline(ifs_timestamp, s); |
| 158 | getline(ifs_timestamp, s); |
| 159 | |
| 160 | while (!ifs_timestamp.eof()) |
| 161 | { |
| 162 | getline(ifs_timestamp, s); |
| 163 | if (!s.empty()) |
| 164 | { |
| 165 | std::stringstream ss; |
| 166 | ss << s; |
| 167 | double timestamp; |
| 168 | std::string img_file_name; |
| 169 | ss >> timestamp >> img_file_name; |
| 170 | img_infos.emplace_back(img_info{timestamp, seq_dir_path + "/" + img_file_name}); |
| 171 | // spdlog::info("{}, {}", timestamp, img_file_name); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | ifs_timestamp.close(); |
| 176 | |
| 177 | return img_infos; |
| 178 | } |