1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
diff --git a/src/base/reconstruction.cc b/src/base/reconstruction.cc
index c9a65fc..29358b3 100755
--- a/src/base/reconstruction.cc
+++ b/src/base/reconstruction.cc
@@ -972,7 +972,7 @@ void Reconstruction::ImportPLY(const std::string& path) {
}
}
-bool Reconstruction::ExportNVM(const std::string& path) const {
+bool Reconstruction::ExportNVM(const std::string& path, const std::string& image_path) const {
std::ofstream file(path, std::ios::trunc);
CHECK(file.is_open()) << path;
@@ -999,7 +999,13 @@ bool Reconstruction::ExportNVM(const std::string& path) const {
-1 * camera.Params(SimpleRadialCameraModel::extra_params_idxs[0]);
const Eigen::Vector3d proj_center = image.ProjectionCenter();
- file << image.Name() << " ";
+ //fix white space in nvm path acordingly
+ std::string image_path_nvm = image_path ;
+ std::transform(image_path_nvm.begin(), image_path_nvm.end(), image_path_nvm.begin(), [](char ch) {
+ return ch == ' ' ? '"' : ch;
+ });
+
+ file << JoinPaths(image_path_nvm, image.Name()) << " ";
file << f << " ";
file << image.Qvec(0) << " ";
file << image.Qvec(1) << " ";
diff --git a/src/base/reconstruction.h b/src/base/reconstruction.h
index 7cb5ffb..c2b1d84 100755
--- a/src/base/reconstruction.h
+++ b/src/base/reconstruction.h
@@ -229,7 +229,7 @@ class Reconstruction {
void ImportPLY(const std::string& path);
// Export to other data formats.
- bool ExportNVM(const std::string& path) const;
+ bool ExportNVM(const std::string& path,const std::string& image_path) const;
bool ExportBundler(const std::string& path,
const std::string& list_path) const;
void ExportPLY(const std::string& path) const;
diff --git a/src/exe/colmap.cc b/src/exe/colmap.cc
index 0a8476b..07e2954 100755
--- a/src/exe/colmap.cc
+++ b/src/exe/colmap.cc
@@ -838,7 +838,7 @@ int RunModelConverter(int argc, char** argv) {
} else if (output_type == "txt") {
reconstruction.WriteText(output_path);
} else if (output_type == "nvm") {
- reconstruction.ExportNVM(output_path);
+ reconstruction.ExportNVM(output_path,*options.image_path);
} else if (output_type == "bundler") {
reconstruction.ExportBundler(output_path + ".bundle.out",
output_path + ".list.txt");
diff --git a/src/ui/main_window.cc b/src/ui/main_window.cc
index 2811fc4..e01a4bb 100755
--- a/src/ui/main_window.cc
+++ b/src/ui/main_window.cc
@@ -807,7 +807,7 @@ void MainWindow::ExportAs() {
const Reconstruction& reconstruction =
reconstruction_manager_.Get(SelectedReconstructionIdx());
if (filter == "NVM (*.nvm)") {
- reconstruction.ExportNVM(export_path);
+ reconstruction.ExportNVM(export_path,*options_.image_path);
} else if (filter == "Bundler (*.out)") {
reconstruction.ExportBundler(export_path, export_path + ".list.txt");
} else if (filter == "PLY (*.ply)") {
|