| 125 | } |
| 126 | |
| 127 | Settings::Settings(const std::string &configFile, const int& sensor) : |
| 128 | bNeedToUndistort_(false), bNeedToRectify_(false), bNeedToResize1_(false), bNeedToResize2_(false) { |
| 129 | sensor_ = sensor; |
| 130 | |
| 131 | //Open settings file |
| 132 | cv::FileStorage fSettings(configFile, cv::FileStorage::READ); |
| 133 | if (!fSettings.isOpened()) { |
| 134 | cerr << "[ERROR]: could not open configuration file at: " << configFile << endl; |
| 135 | cerr << "Aborting..." << endl; |
| 136 | |
| 137 | exit(-1); |
| 138 | } |
| 139 | else{ |
| 140 | cout << "Loading settings from " << configFile << endl; |
| 141 | } |
| 142 | |
| 143 | //Read first camera |
| 144 | readCamera1(fSettings); |
| 145 | cout << "\t-Loaded camera 1" << endl; |
| 146 | |
| 147 | //Read second camera if stereo (not rectified) |
| 148 | if(sensor_ == System::STEREO || sensor_ == System::IMU_STEREO){ |
| 149 | readCamera2(fSettings); |
| 150 | cout << "\t-Loaded camera 2" << endl; |
| 151 | } |
| 152 | |
| 153 | //Read image info |
| 154 | readImageInfo(fSettings); |
| 155 | cout << "\t-Loaded image info" << endl; |
| 156 | |
| 157 | if(sensor_ == System::IMU_MONOCULAR || sensor_ == System::IMU_STEREO || sensor_ == System::IMU_RGBD){ |
| 158 | readIMU(fSettings); |
| 159 | cout << "\t-Loaded IMU calibration" << endl; |
| 160 | } |
| 161 | |
| 162 | if(sensor_ == System::RGBD || sensor_ == System::IMU_RGBD){ |
| 163 | readRGBD(fSettings); |
| 164 | cout << "\t-Loaded RGB-D calibration" << endl; |
| 165 | } |
| 166 | |
| 167 | readORB(fSettings); |
| 168 | cout << "\t-Loaded ORB settings" << endl; |
| 169 | readViewer(fSettings); |
| 170 | cout << "\t-Loaded viewer settings" << endl; |
| 171 | readLoadAndSave(fSettings); |
| 172 | cout << "\t-Loaded Atlas settings" << endl; |
| 173 | readOtherParameters(fSettings); |
| 174 | cout << "\t-Loaded misc parameters" << endl; |
| 175 | |
| 176 | if(bNeedToRectify_){ |
| 177 | precomputeRectificationMaps(); |
| 178 | cout << "\t-Computed rectification maps" << endl; |
| 179 | } |
| 180 | |
| 181 | cout << "----------------------------------" << endl; |
| 182 | } |
| 183 | |
| 184 | void Settings::readCamera1(cv::FileStorage &fSettings) { |
nothing calls this directly
no outgoing calls
no test coverage detected