| 68 | } |
| 69 | |
| 70 | void WriteBoundingBox(const std::filesystem::path& reconstruction_path, |
| 71 | const Eigen::AlignedBox3d& bbox, |
| 72 | const std::string& suffix = "") { |
| 73 | const Eigen::Vector3d extent = bbox.diagonal(); |
| 74 | // write axis-aligned bounding box |
| 75 | { |
| 76 | const auto path = reconstruction_path / ("bbox_aligned" + suffix + ".txt"); |
| 77 | std::ofstream file(path, std::ios::trunc); |
| 78 | THROW_CHECK_FILE_OPEN(file, path); |
| 79 | |
| 80 | // Ensure that we don't lose any precision by storing in text. |
| 81 | file.imbue(std::locale::classic()); |
| 82 | file.precision(17); |
| 83 | file << bbox.min().transpose() << '\n'; |
| 84 | file << bbox.max().transpose() << '\n'; |
| 85 | } |
| 86 | // write oriented bounding box |
| 87 | { |
| 88 | const auto path = reconstruction_path / ("bbox_oriented" + suffix + ".txt"); |
| 89 | std::ofstream file(path, std::ios::trunc); |
| 90 | THROW_CHECK_FILE_OPEN(file, path); |
| 91 | |
| 92 | // Ensure that we don't lose any precision by storing in text. |
| 93 | file.imbue(std::locale::classic()); |
| 94 | file.precision(17); |
| 95 | const Eigen::Vector3d center = (bbox.min() + bbox.max()) * 0.5; |
| 96 | file << center.transpose() << "\n\n"; |
| 97 | file << "1 0 0\n0 1 0\n0 0 1\n\n"; |
| 98 | file << extent.transpose() << '\n'; |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | std::vector<Eigen::Vector3d> ConvertCameraLocations( |
| 103 | const bool ref_is_gps, |
no outgoing calls
no test coverage detected