| 105 | //////////////////////////////////////////////////////////////////////////////// |
| 106 | |
| 107 | void |
| 108 | pcl::ihs::OfflineIntegration::computationThread() |
| 109 | { |
| 110 | std::vector<std::string> filenames; |
| 111 | |
| 112 | if (!this->getFilesFromDirectory(path_dir_, ".pcd", filenames)) { |
| 113 | std::cerr << "ERROR in offline_integration.cpp: Could not get the files from the " |
| 114 | "directory\n"; |
| 115 | return; |
| 116 | } |
| 117 | |
| 118 | // First cloud is reference model |
| 119 | std::cerr << "Processing file " << std::setw(5) << 1 << " / " << filenames.size() |
| 120 | << std::endl; |
| 121 | CloudXYZRGBNormalPtr cloud_model(new CloudXYZRGBNormal()); |
| 122 | Eigen::Matrix4f T = Eigen::Matrix4f::Identity(); |
| 123 | if (!this->load(filenames[0], cloud_model, T)) { |
| 124 | std::cerr << "ERROR in offline_integration.cpp: Could not load the model cloud.\n"; |
| 125 | return; |
| 126 | } |
| 127 | |
| 128 | pcl::transformPointCloudWithNormals(*cloud_model, *cloud_model, T); |
| 129 | |
| 130 | if (!integration_->reconstructMesh(cloud_model, mesh_model_)) { |
| 131 | std::cerr |
| 132 | << "ERROR in offline_integration.cpp: Could not reconstruct the model mesh.\n"; |
| 133 | return; |
| 134 | } |
| 135 | |
| 136 | Base::setPivot("model"); |
| 137 | Base::addMesh(mesh_model_, "model"); |
| 138 | |
| 139 | if (filenames.empty()) { |
| 140 | return; |
| 141 | } |
| 142 | |
| 143 | for (std::size_t i = 1; i < filenames.size(); ++i) { |
| 144 | std::cerr << "Processing file " << std::setw(5) << i + 1 << " / " |
| 145 | << filenames.size() << std::endl; |
| 146 | |
| 147 | { |
| 148 | std::lock_guard<std::mutex> lock(mutex_); |
| 149 | if (destructor_called_) |
| 150 | return; |
| 151 | } |
| 152 | std::unique_lock<std::mutex> lock_quit(mutex_quit_); |
| 153 | |
| 154 | CloudXYZRGBNormalPtr cloud_data(new CloudXYZRGBNormal()); |
| 155 | if (!this->load(filenames[i], cloud_data, T)) { |
| 156 | std::cerr << "ERROR in offline_integration.cpp: Could not load the data cloud.\n"; |
| 157 | return; |
| 158 | } |
| 159 | |
| 160 | if (!integration_->merge(cloud_data, mesh_model_, T)) { |
| 161 | std::cerr << "ERROR in offline_integration.cpp: merge failed.\n"; |
| 162 | return; |
| 163 | } |
| 164 |
nothing calls this directly
no test coverage detected