MCPcopy Create free account
hub / github.com/colmap/colmap / WriteBoundingBox

Function WriteBoundingBox

src/colmap/exe/model.cc:70–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70void 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
102std::vector<Eigen::Vector3d> ConvertCameraLocations(
103 const bool ref_is_gps,

Callers 2

RunModelCropperFunction · 0.85
RunModelSplitterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected