diff --git a/reconstruct/src/main.cpp b/reconstruct/src/main.cpp index d38d13f9a9c5944b41d9a4607b18e67bc17ea6b8..9c9400e3a2ea05f3d88b1142de444ee3d4a071d4 100644 --- a/reconstruct/src/main.cpp +++ b/reconstruct/src/main.cpp @@ -135,6 +135,14 @@ public: std::map<string, Eigen::Matrix4f> loadRegistration() { std::map<string, Eigen::Matrix4f> registration; std::ifstream file(string(FTL_LOCAL_CONFIG_ROOT) + "/registration.json"); + + // Use identity transform if no registration + if (!file.is_open()) { + Eigen::Matrix4f T; + registration["default"] = T.setIdentity(); + return registration; + } + nlohmann::json load; file >> load; @@ -327,7 +335,10 @@ static void run() { registration = loadRegistration(); } vector<Eigen::Matrix4f> T; - for (auto &input : inputs) { T.push_back(registration[input.getURI()]); } + for (auto &input : inputs) { + Eigen::Matrix4f RT = (registration.count(input.getURI()) > 0) ? registration[input.getURI()] : registration["default"]; + T.push_back(RT); + } // vector<PointCloud<PointXYZRGB>::Ptr> clouds(inputs.size());