From 2bff8c9fb6578de04045c8fdefbc4c4d4cbd6331 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Mon, 20 May 2019 16:33:52 +0300 Subject: [PATCH] Allow for missing registration file, use identity by default --- reconstruct/src/main.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/reconstruct/src/main.cpp b/reconstruct/src/main.cpp index d38d13f9a..9c9400e3a 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()); -- GitLab