| 437 | } |
| 438 | |
| 439 | void convertToColmapScene(const sfmData::SfMData& sfmData, const std::string& colmapBaseDir, bool copyImages) |
| 440 | { |
| 441 | // retrieve the views that are compatible with Colmap and that can be exported |
| 442 | const auto views2export = getColmapCompatibleViews(sfmData); |
| 443 | if (views2export.empty()) |
| 444 | { |
| 445 | ALICEVISION_LOG_WARNING("No camera in the scene is compatible with Colmap"); |
| 446 | return; |
| 447 | } |
| 448 | ALICEVISION_LOG_INFO("Found " << views2export.size() << "/" << sfmData.getValidViews().size() |
| 449 | << " views to export " |
| 450 | "that are compatible with Colmap"); |
| 451 | |
| 452 | ColmapConfig colmapParams{colmapBaseDir}; |
| 453 | |
| 454 | // Generate the folder structure for colmap |
| 455 | ALICEVISION_LOG_INFO("Creating Colmap subfolders..."); |
| 456 | create_directories(colmapParams._sparseDirectory); |
| 457 | create_directories(colmapParams._denseDirectory); |
| 458 | create_directories(colmapParams._imagesDirectory); |
| 459 | |
| 460 | if (copyImages) |
| 461 | { |
| 462 | ALICEVISION_LOG_INFO("Copying source images..."); |
| 463 | copyImagesFromSfmData(sfmData, colmapParams._imagesDirectory, views2export); |
| 464 | } |
| 465 | |
| 466 | ALICEVISION_LOG_INFO("Generating Colmap files..."); |
| 467 | generateColmapSceneFiles(sfmData, views2export, colmapParams); |
| 468 | } |
| 469 | |
| 470 | } // namespace sfmDataIO |
| 471 | } // namespace aliceVision |
no test coverage detected