| 248 | //////////////////////////////////////////////////////////////////////////////// |
| 249 | |
| 250 | bool |
| 251 | pcl::ihs::OfflineIntegration::load(const std::string& filename, |
| 252 | CloudXYZRGBNormalPtr& cloud, |
| 253 | Eigen::Matrix4f& T) const |
| 254 | { |
| 255 | if (!cloud) { |
| 256 | cloud = CloudXYZRGBNormalPtr(new CloudXYZRGBNormal()); |
| 257 | } |
| 258 | |
| 259 | // Load the cloud. |
| 260 | CloudXYZRGBAPtr cloud_input(new CloudXYZRGBA()); |
| 261 | |
| 262 | pcl::PCDReader reader; |
| 263 | if (reader.read(filename, *cloud_input) < 0) { |
| 264 | std::cerr << "ERROR in offline_integration.cpp: Could not read the pcd file.\n"; |
| 265 | return (false); |
| 266 | } |
| 267 | |
| 268 | // Normal estimation. |
| 269 | normal_estimation_->setInputCloud(cloud_input); |
| 270 | normal_estimation_->compute(*cloud); |
| 271 | |
| 272 | pcl::copyPointCloud(*cloud_input, *cloud); |
| 273 | |
| 274 | // Change the file extension of the file. |
| 275 | // Load the transformation. |
| 276 | std::string fn_transform = filename; |
| 277 | |
| 278 | std::size_t pos = fn_transform.find_last_of('.'); |
| 279 | if (pos == std::string::npos || pos == (fn_transform.size() - 1)) { |
| 280 | std::cerr << "ERROR in offline_integration.cpp: No file extension\n"; |
| 281 | return (false); |
| 282 | } |
| 283 | |
| 284 | fn_transform.replace(pos, std::string::npos, ".transform"); |
| 285 | |
| 286 | if (!this->loadTransform(fn_transform, T)) { |
| 287 | std::cerr |
| 288 | << "ERROR in offline_integration.cpp: Could not load the transformation.\n"; |
| 289 | return (false); |
| 290 | } |
| 291 | |
| 292 | return (true); |
| 293 | } |
| 294 | |
| 295 | //////////////////////////////////////////////////////////////////////////////// |
| 296 |
no test coverage detected