| 81 | } |
| 82 | |
| 83 | bool ParseData::parseSceneMetadata(const std::string& scene_metadata_path) |
| 84 | { |
| 85 | |
| 86 | std::string line; |
| 87 | std::vector<std::string> splitS; |
| 88 | std::ifstream scene_metadata(scene_metadata_path); |
| 89 | if (!scene_metadata.is_open()) { |
| 90 | return false; |
| 91 | } |
| 92 | |
| 93 | uint camId = 0; |
| 94 | |
| 95 | while (safeGetline(scene_metadata, line)) |
| 96 | |
| 97 | { |
| 98 | if (line.compare("[list_images]") == 0) |
| 99 | { |
| 100 | safeGetline(scene_metadata, line); // ignore template specification line |
| 101 | ImageListFile::Infos infos; |
| 102 | int id; |
| 103 | while (safeGetline(scene_metadata, line)) |
| 104 | { |
| 105 | // std::cerr << line << std::endl; |
| 106 | split(splitS, line, is_any_of(" ")); |
| 107 | // std::cerr << splitS.size() << std::endl; |
| 108 | if (splitS.size() > 1) { |
| 109 | infos.filename = splitS[0]; |
| 110 | infos.width = stoi(splitS[1]); |
| 111 | infos.height = stoi(splitS[2]); |
| 112 | infos.camId = camId; |
| 113 | |
| 114 | //infos.filename.erase(infos.filename.find_last_of("."), std::string::npos); |
| 115 | id = atoi(infos.filename.c_str()); |
| 116 | |
| 117 | InputCamera::Z nearFar(100.0f, 0.1f); |
| 118 | |
| 119 | if (splitS.size() > 3) { |
| 120 | nearFar.near = stof(splitS[3]); |
| 121 | nearFar.far = stof(splitS[4]); |
| 122 | } |
| 123 | _imgInfos.push_back(infos); |
| 124 | |
| 125 | ++camId; |
| 126 | infos.filename.clear(); |
| 127 | splitS.clear(); |
| 128 | } |
| 129 | else |
| 130 | break; |
| 131 | } |
| 132 | } |
| 133 | else if (line.compare("[active_images]") == 0) { |
| 134 | |
| 135 | safeGetline(scene_metadata, line); // ignore template specification line |
| 136 | |
| 137 | _activeImages.resize(_imgInfos.size()); |
| 138 | |
| 139 | for (int i = 0; i < _imgInfos.size(); i++) |
| 140 | _activeImages[i] = false; |