nvs2colmap 0.3.2__tar.gz → 0.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/PKG-INFO +24 -15
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/README.md +23 -14
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/colmap.py +8 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/dynamic3dgs/__main__.py +8 -8
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/n3dv/__main__.py +1 -1
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/utils/__init__.py +2 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/utils/colmap.py +46 -2
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap.egg-info/PKG-INFO +24 -15
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/pyproject.toml +1 -1
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/LICENSE +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/__init__.py +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/dynamic3dgs/camera_meta.py +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/dynamic3dgs/link_frames.py +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/dynamic3dgs/points.py +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/extract_videos.py +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/n3dv/extract_videos.py +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/n3dv/poses_bounds.py +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/stnerf/__init__.py +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/utils/ffmpeg.py +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/utils/rotation.py +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/write_model.py +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap/write_pcd.py +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap.egg-info/SOURCES.txt +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap.egg-info/dependency_links.txt +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap.egg-info/entry_points.txt +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap.egg-info/requires.txt +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/nvs2colmap.egg-info/top_level.txt +0 -0
- {nvs2colmap-0.3.2 → nvs2colmap-0.4.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nvs2colmap
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: Utilities for converting novel view synthesis datasets to COLMAP format.
|
|
5
5
|
Author-email: Howard Yin <yindaheng98@gmail.com>
|
|
6
6
|
Maintainer-email: Howard Yin <yindaheng98@gmail.com>
|
|
@@ -31,6 +31,8 @@ Dynamic: license-file
|
|
|
31
31
|
|
|
32
32
|
Utilities for converting novel view synthesis datasets to COLMAP format.
|
|
33
33
|
|
|
34
|
+
**These scenes are prepared for [InstantSplat](https://github.com/yindaheng98/InstantSplat). InstantSplat initializes one frame at a time and does not undistort a whole sequence, so this repository undistorts every frame. The default commands write known-pose `sparse/0` text models and do not call COLMAP. `--use-colmap` runs feature extraction, matching, triangulation, mapping, `image_undistorter`, and `mask_undistorter` on every frame. Undistorted images go to `images/`, and undistorted masks go to `image_masks/`.**
|
|
35
|
+
|
|
34
36
|
## Supported Formats
|
|
35
37
|
|
|
36
38
|
- **Neural 3D Video Dataset**: scenes with `poses_bounds.npy` and one `mp4`
|
|
@@ -65,11 +67,13 @@ pip install numpy plyfile torch
|
|
|
65
67
|
```
|
|
66
68
|
|
|
67
69
|
For Neural 3D Video scenes, the command also needs `ffmpeg` and `ffprobe` on
|
|
68
|
-
`PATH`, or explicit paths via `--ffmpeg` and `--ffprobe`.
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
`PATH`, or explicit paths via `--ffmpeg` and `--ffprobe`. To run the COLMAP
|
|
71
|
+
reconstruction that
|
|
72
|
+
[InstantSplat](https://github.com/yindaheng98/InstantSplat) continues from,
|
|
73
|
+
also provide a COLMAP executable via `--colmap-executable`.
|
|
71
74
|
|
|
72
|
-
Extract a Neural 3D Video scene and write per-frame COLMAP text models
|
|
75
|
+
Extract a Neural 3D Video scene and write per-frame COLMAP text models for
|
|
76
|
+
[InstantSplat](https://github.com/yindaheng98/InstantSplat):
|
|
73
77
|
|
|
74
78
|
```bash
|
|
75
79
|
python -m nvs2colmap.n3dv \
|
|
@@ -90,7 +94,8 @@ python -m nvs2colmap.n3dv \
|
|
|
90
94
|
--n-frames 300
|
|
91
95
|
```
|
|
92
96
|
|
|
93
|
-
Run
|
|
97
|
+
Run COLMAP reconstruction and undistortion for each frame, for
|
|
98
|
+
[InstantSplat](https://github.com/yindaheng98/InstantSplat):
|
|
94
99
|
|
|
95
100
|
```bash
|
|
96
101
|
python -m nvs2colmap.n3dv \
|
|
@@ -105,7 +110,8 @@ python -m nvs2colmap.n3dv \
|
|
|
105
110
|
```
|
|
106
111
|
|
|
107
112
|
Link a Dynamic 3D Gaussians scene, including its masks, and write per-frame
|
|
108
|
-
COLMAP text models
|
|
113
|
+
COLMAP text models for
|
|
114
|
+
[InstantSplat](https://github.com/yindaheng98/InstantSplat):
|
|
109
115
|
|
|
110
116
|
```bash
|
|
111
117
|
python -m nvs2colmap.dynamic3dgs \
|
|
@@ -116,16 +122,19 @@ python -m nvs2colmap.dynamic3dgs \
|
|
|
116
122
|
For Neural 3D Video scenes, decoded frames are written to `frame*/images` by
|
|
117
123
|
default, and the command also writes `frame*/sparse/0` text models. With
|
|
118
124
|
`--use-colmap`, decoded frames are written to `frame*/input`, and each frame
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
from source video frame `N`,
|
|
122
|
-
from `N`.
|
|
125
|
+
gets `distorted/sparse/0` plus undistorted `images/`, `sparse/`, and `stereo/`
|
|
126
|
+
for [InstantSplat](https://github.com/yindaheng98/InstantSplat). When
|
|
127
|
+
`--start-number N` is provided, decoding starts from source video frame `N`,
|
|
128
|
+
and the generated folders/images are also numbered from `N`.
|
|
123
129
|
|
|
124
130
|
For Dynamic 3D Gaussians scenes, images from both `train_meta.json` and
|
|
125
131
|
`test_meta.json` are hardlinked into `frame*/images`, and included masks are
|
|
126
132
|
hardlinked into `frame*/image_masks` (`cam01.jpg` pairs with `cam01.jpg.png`).
|
|
127
133
|
`--no-train-camera` and `--no-test-camera` drop one split. The same
|
|
128
|
-
`--use-colmap` switch writes images to `frame*/input
|
|
129
|
-
`frame*/input_mask`, and
|
|
130
|
-
|
|
131
|
-
`
|
|
134
|
+
`--use-colmap` switch writes images to `frame*/input` and masks to
|
|
135
|
+
`frame*/input_mask`, then undistorts them to `images/` and `image_masks/`
|
|
136
|
+
for [InstantSplat](https://github.com/yindaheng98/InstantSplat). That switch
|
|
137
|
+
does not write `init_pt_cld.npz` into `sparse/0/points3D.ply`; the
|
|
138
|
+
reconstructed points stay in `distorted/sparse/0` and the undistorted
|
|
139
|
+
`sparse/`. `--start-number` uses the same 1-based output numbering; source
|
|
140
|
+
file `000000.jpg` is frame `1`.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Utilities for converting novel view synthesis datasets to COLMAP format.
|
|
4
4
|
|
|
5
|
+
**These scenes are prepared for [InstantSplat](https://github.com/yindaheng98/InstantSplat). InstantSplat initializes one frame at a time and does not undistort a whole sequence, so this repository undistorts every frame. The default commands write known-pose `sparse/0` text models and do not call COLMAP. `--use-colmap` runs feature extraction, matching, triangulation, mapping, `image_undistorter`, and `mask_undistorter` on every frame. Undistorted images go to `images/`, and undistorted masks go to `image_masks/`.**
|
|
6
|
+
|
|
5
7
|
## Supported Formats
|
|
6
8
|
|
|
7
9
|
- **Neural 3D Video Dataset**: scenes with `poses_bounds.npy` and one `mp4`
|
|
@@ -36,11 +38,13 @@ pip install numpy plyfile torch
|
|
|
36
38
|
```
|
|
37
39
|
|
|
38
40
|
For Neural 3D Video scenes, the command also needs `ffmpeg` and `ffprobe` on
|
|
39
|
-
`PATH`, or explicit paths via `--ffmpeg` and `--ffprobe`.
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
`PATH`, or explicit paths via `--ffmpeg` and `--ffprobe`. To run the COLMAP
|
|
42
|
+
reconstruction that
|
|
43
|
+
[InstantSplat](https://github.com/yindaheng98/InstantSplat) continues from,
|
|
44
|
+
also provide a COLMAP executable via `--colmap-executable`.
|
|
42
45
|
|
|
43
|
-
Extract a Neural 3D Video scene and write per-frame COLMAP text models
|
|
46
|
+
Extract a Neural 3D Video scene and write per-frame COLMAP text models for
|
|
47
|
+
[InstantSplat](https://github.com/yindaheng98/InstantSplat):
|
|
44
48
|
|
|
45
49
|
```bash
|
|
46
50
|
python -m nvs2colmap.n3dv \
|
|
@@ -61,7 +65,8 @@ python -m nvs2colmap.n3dv \
|
|
|
61
65
|
--n-frames 300
|
|
62
66
|
```
|
|
63
67
|
|
|
64
|
-
Run
|
|
68
|
+
Run COLMAP reconstruction and undistortion for each frame, for
|
|
69
|
+
[InstantSplat](https://github.com/yindaheng98/InstantSplat):
|
|
65
70
|
|
|
66
71
|
```bash
|
|
67
72
|
python -m nvs2colmap.n3dv \
|
|
@@ -76,7 +81,8 @@ python -m nvs2colmap.n3dv \
|
|
|
76
81
|
```
|
|
77
82
|
|
|
78
83
|
Link a Dynamic 3D Gaussians scene, including its masks, and write per-frame
|
|
79
|
-
COLMAP text models
|
|
84
|
+
COLMAP text models for
|
|
85
|
+
[InstantSplat](https://github.com/yindaheng98/InstantSplat):
|
|
80
86
|
|
|
81
87
|
```bash
|
|
82
88
|
python -m nvs2colmap.dynamic3dgs \
|
|
@@ -87,16 +93,19 @@ python -m nvs2colmap.dynamic3dgs \
|
|
|
87
93
|
For Neural 3D Video scenes, decoded frames are written to `frame*/images` by
|
|
88
94
|
default, and the command also writes `frame*/sparse/0` text models. With
|
|
89
95
|
`--use-colmap`, decoded frames are written to `frame*/input`, and each frame
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
from source video frame `N`,
|
|
93
|
-
from `N`.
|
|
96
|
+
gets `distorted/sparse/0` plus undistorted `images/`, `sparse/`, and `stereo/`
|
|
97
|
+
for [InstantSplat](https://github.com/yindaheng98/InstantSplat). When
|
|
98
|
+
`--start-number N` is provided, decoding starts from source video frame `N`,
|
|
99
|
+
and the generated folders/images are also numbered from `N`.
|
|
94
100
|
|
|
95
101
|
For Dynamic 3D Gaussians scenes, images from both `train_meta.json` and
|
|
96
102
|
`test_meta.json` are hardlinked into `frame*/images`, and included masks are
|
|
97
103
|
hardlinked into `frame*/image_masks` (`cam01.jpg` pairs with `cam01.jpg.png`).
|
|
98
104
|
`--no-train-camera` and `--no-test-camera` drop one split. The same
|
|
99
|
-
`--use-colmap` switch writes images to `frame*/input
|
|
100
|
-
`frame*/input_mask`, and
|
|
101
|
-
|
|
102
|
-
`
|
|
105
|
+
`--use-colmap` switch writes images to `frame*/input` and masks to
|
|
106
|
+
`frame*/input_mask`, then undistorts them to `images/` and `image_masks/`
|
|
107
|
+
for [InstantSplat](https://github.com/yindaheng98/InstantSplat). That switch
|
|
108
|
+
does not write `init_pt_cld.npz` into `sparse/0/points3D.ply`; the
|
|
109
|
+
reconstructed points stay in `distorted/sparse/0` and the undistorted
|
|
110
|
+
`sparse/`. `--start-number` uses the same 1-based output numbering; source
|
|
111
|
+
file `000000.jpg` is frame `1`.
|
|
@@ -12,6 +12,7 @@ from nvs2colmap.utils.colmap import (
|
|
|
12
12
|
feature_extractor,
|
|
13
13
|
image_undistorter,
|
|
14
14
|
mapper,
|
|
15
|
+
mask_undistorter,
|
|
15
16
|
point_triangulator,
|
|
16
17
|
read_db,
|
|
17
18
|
)
|
|
@@ -39,6 +40,7 @@ def run_colmap(
|
|
|
39
40
|
image_extension: str = ".png",
|
|
40
41
|
colmap_executable: str = "colmap",
|
|
41
42
|
use_gpu: str = "1",
|
|
43
|
+
has_mask: bool = False,
|
|
42
44
|
) -> None:
|
|
43
45
|
folder = Path(folder)
|
|
44
46
|
colmap_cameras, colmap_images = build_colmap_records(cameras, image_extension)
|
|
@@ -68,6 +70,10 @@ def run_colmap(
|
|
|
68
70
|
# To fit sparse init in instantsplat
|
|
69
71
|
if image_undistorter(str(folder), colmap_executable=colmap_executable) != 0:
|
|
70
72
|
raise RuntimeError("Image undistortion failed")
|
|
73
|
+
if has_mask:
|
|
74
|
+
image_names = [f"{camera.name}{image_extension}" for camera in cameras]
|
|
75
|
+
if mask_undistorter(folder, image_names, colmap_executable=colmap_executable) != 0:
|
|
76
|
+
raise RuntimeError("Mask undistortion failed")
|
|
71
77
|
|
|
72
78
|
|
|
73
79
|
def run_video_colmap(
|
|
@@ -78,6 +84,7 @@ def run_video_colmap(
|
|
|
78
84
|
image_extension: str = ".png",
|
|
79
85
|
colmap_executable: str = "colmap",
|
|
80
86
|
use_gpu: str = "1",
|
|
87
|
+
has_mask: bool = False,
|
|
81
88
|
) -> None:
|
|
82
89
|
output_pattern = str(output_pattern)
|
|
83
90
|
for frame in range(start_number, start_number + n_frames):
|
|
@@ -87,4 +94,5 @@ def run_video_colmap(
|
|
|
87
94
|
image_extension=image_extension,
|
|
88
95
|
colmap_executable=colmap_executable,
|
|
89
96
|
use_gpu=use_gpu,
|
|
97
|
+
has_mask=has_mask,
|
|
90
98
|
)
|
|
@@ -57,7 +57,7 @@ def parse_args() -> argparse.Namespace:
|
|
|
57
57
|
action="store_true",
|
|
58
58
|
help=(
|
|
59
59
|
"Run COLMAP feature extraction, matching, triangulation, mapping, "
|
|
60
|
-
"and undistortion instead of only writing sparse/0 text models."
|
|
60
|
+
"and undistortion of images and masks instead of only writing sparse/0 text models."
|
|
61
61
|
),
|
|
62
62
|
)
|
|
63
63
|
parser.add_argument(
|
|
@@ -115,6 +115,12 @@ def main() -> None:
|
|
|
115
115
|
start_number=args.start_number,
|
|
116
116
|
image_extension="",
|
|
117
117
|
)
|
|
118
|
+
write_init_point_cloud(
|
|
119
|
+
npz_path=folder / "init_pt_cld.npz",
|
|
120
|
+
output_pattern=frame_output_pattern / "sparse" / "0" / "points3D.ply",
|
|
121
|
+
n_frames=n_frames,
|
|
122
|
+
start_number=args.start_number,
|
|
123
|
+
)
|
|
118
124
|
else:
|
|
119
125
|
run_video_colmap(
|
|
120
126
|
output_pattern=frame_output_pattern,
|
|
@@ -124,15 +130,9 @@ def main() -> None:
|
|
|
124
130
|
image_extension="",
|
|
125
131
|
colmap_executable=args.colmap_executable,
|
|
126
132
|
use_gpu=args.colmap_use_gpu,
|
|
133
|
+
has_mask=True,
|
|
127
134
|
)
|
|
128
135
|
|
|
129
|
-
write_init_point_cloud(
|
|
130
|
-
npz_path=folder / "init_pt_cld.npz",
|
|
131
|
-
output_pattern=frame_output_pattern / "sparse" / "0" / "points3D.ply",
|
|
132
|
-
n_frames=n_frames,
|
|
133
|
-
start_number=args.start_number,
|
|
134
|
-
)
|
|
135
|
-
|
|
136
136
|
print(f"Done: {folder}")
|
|
137
137
|
|
|
138
138
|
|
|
@@ -74,7 +74,7 @@ def parse_args() -> argparse.Namespace:
|
|
|
74
74
|
action="store_true",
|
|
75
75
|
help=(
|
|
76
76
|
"Run COLMAP feature extraction, matching, triangulation, mapping, "
|
|
77
|
-
"and undistortion instead of only writing sparse/0 text models."
|
|
77
|
+
"and image undistortion instead of only writing sparse/0 text models."
|
|
78
78
|
),
|
|
79
79
|
)
|
|
80
80
|
parser.add_argument(
|
|
@@ -6,6 +6,7 @@ from .colmap import (
|
|
|
6
6
|
feature_extractor,
|
|
7
7
|
image_undistorter,
|
|
8
8
|
mapper,
|
|
9
|
+
mask_undistorter,
|
|
9
10
|
model_converter_bin,
|
|
10
11
|
model_converter_txt,
|
|
11
12
|
point_triangulator,
|
|
@@ -23,6 +24,7 @@ __all__ = [
|
|
|
23
24
|
"feature_extractor",
|
|
24
25
|
"image_undistorter",
|
|
25
26
|
"mapper",
|
|
27
|
+
"mask_undistorter",
|
|
26
28
|
"matrix_to_quaternion",
|
|
27
29
|
"model_converter_bin",
|
|
28
30
|
"model_converter_txt",
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"""COLMAP command helpers."""
|
|
2
2
|
|
|
3
|
+
import os
|
|
4
|
+
import shutil
|
|
3
5
|
import sqlite3
|
|
4
6
|
import subprocess
|
|
5
|
-
import
|
|
7
|
+
from pathlib import Path
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
def execute(cmd):
|
|
@@ -62,7 +64,6 @@ def mapper(folder, mapper_input_path, colmap_executable="colmap"):
|
|
|
62
64
|
colmap_executable, "mapper",
|
|
63
65
|
"--database_path", os.path.join(folder, "distorted", "database.db"),
|
|
64
66
|
"--image_path", os.path.join(folder, "input"),
|
|
65
|
-
"--Mapper.ba_global_function_tolerance=0.000001",
|
|
66
67
|
"--input_path", mapper_input_path,
|
|
67
68
|
"--output_path", os.path.join(folder, "distorted", "sparse", "0")
|
|
68
69
|
]
|
|
@@ -102,3 +103,46 @@ def image_undistorter(folder, colmap_executable="colmap"):
|
|
|
102
103
|
"--output_type=COLMAP",
|
|
103
104
|
]
|
|
104
105
|
return execute(cmd)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def mask_undistorter(folder, image_names, colmap_executable="colmap"):
|
|
109
|
+
folder = Path(folder)
|
|
110
|
+
image_names = [Path(name) for name in image_names]
|
|
111
|
+
tmp_mask = folder / "tmp_mask"
|
|
112
|
+
shutil.rmtree(tmp_mask, ignore_errors=True)
|
|
113
|
+
linked = False
|
|
114
|
+
for image_name in image_names:
|
|
115
|
+
src = folder / "input_mask" / image_name.with_name(image_name.name + ".png")
|
|
116
|
+
if not src.is_file():
|
|
117
|
+
continue
|
|
118
|
+
dst = tmp_mask / image_name
|
|
119
|
+
dst.parent.mkdir(parents=True, exist_ok=True)
|
|
120
|
+
os.link(src, dst)
|
|
121
|
+
linked = True
|
|
122
|
+
if not linked:
|
|
123
|
+
shutil.rmtree(tmp_mask, ignore_errors=True)
|
|
124
|
+
return 0
|
|
125
|
+
tmp_sparse = folder / "tmp_mask_sparse"
|
|
126
|
+
shutil.rmtree(tmp_sparse, ignore_errors=True)
|
|
127
|
+
ret = execute([
|
|
128
|
+
colmap_executable, "image_undistorter",
|
|
129
|
+
"--image_path", os.fspath(tmp_mask),
|
|
130
|
+
"--input_path", os.fspath(folder / "distorted" / "sparse" / "0"),
|
|
131
|
+
"--output_path", os.fspath(tmp_sparse),
|
|
132
|
+
"--output_type=COLMAP",
|
|
133
|
+
])
|
|
134
|
+
shutil.rmtree(tmp_mask, ignore_errors=True)
|
|
135
|
+
if ret != 0:
|
|
136
|
+
shutil.rmtree(tmp_sparse, ignore_errors=True)
|
|
137
|
+
return ret
|
|
138
|
+
for image_name in image_names:
|
|
139
|
+
src = tmp_sparse / "images" / image_name
|
|
140
|
+
if not src.is_file():
|
|
141
|
+
continue
|
|
142
|
+
dst = folder / "image_masks" / image_name.with_name(image_name.name + ".png")
|
|
143
|
+
dst.parent.mkdir(parents=True, exist_ok=True)
|
|
144
|
+
if dst.exists():
|
|
145
|
+
dst.unlink()
|
|
146
|
+
os.link(src, dst)
|
|
147
|
+
shutil.rmtree(tmp_sparse, ignore_errors=True)
|
|
148
|
+
return 0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nvs2colmap
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: Utilities for converting novel view synthesis datasets to COLMAP format.
|
|
5
5
|
Author-email: Howard Yin <yindaheng98@gmail.com>
|
|
6
6
|
Maintainer-email: Howard Yin <yindaheng98@gmail.com>
|
|
@@ -31,6 +31,8 @@ Dynamic: license-file
|
|
|
31
31
|
|
|
32
32
|
Utilities for converting novel view synthesis datasets to COLMAP format.
|
|
33
33
|
|
|
34
|
+
**These scenes are prepared for [InstantSplat](https://github.com/yindaheng98/InstantSplat). InstantSplat initializes one frame at a time and does not undistort a whole sequence, so this repository undistorts every frame. The default commands write known-pose `sparse/0` text models and do not call COLMAP. `--use-colmap` runs feature extraction, matching, triangulation, mapping, `image_undistorter`, and `mask_undistorter` on every frame. Undistorted images go to `images/`, and undistorted masks go to `image_masks/`.**
|
|
35
|
+
|
|
34
36
|
## Supported Formats
|
|
35
37
|
|
|
36
38
|
- **Neural 3D Video Dataset**: scenes with `poses_bounds.npy` and one `mp4`
|
|
@@ -65,11 +67,13 @@ pip install numpy plyfile torch
|
|
|
65
67
|
```
|
|
66
68
|
|
|
67
69
|
For Neural 3D Video scenes, the command also needs `ffmpeg` and `ffprobe` on
|
|
68
|
-
`PATH`, or explicit paths via `--ffmpeg` and `--ffprobe`.
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
`PATH`, or explicit paths via `--ffmpeg` and `--ffprobe`. To run the COLMAP
|
|
71
|
+
reconstruction that
|
|
72
|
+
[InstantSplat](https://github.com/yindaheng98/InstantSplat) continues from,
|
|
73
|
+
also provide a COLMAP executable via `--colmap-executable`.
|
|
71
74
|
|
|
72
|
-
Extract a Neural 3D Video scene and write per-frame COLMAP text models
|
|
75
|
+
Extract a Neural 3D Video scene and write per-frame COLMAP text models for
|
|
76
|
+
[InstantSplat](https://github.com/yindaheng98/InstantSplat):
|
|
73
77
|
|
|
74
78
|
```bash
|
|
75
79
|
python -m nvs2colmap.n3dv \
|
|
@@ -90,7 +94,8 @@ python -m nvs2colmap.n3dv \
|
|
|
90
94
|
--n-frames 300
|
|
91
95
|
```
|
|
92
96
|
|
|
93
|
-
Run
|
|
97
|
+
Run COLMAP reconstruction and undistortion for each frame, for
|
|
98
|
+
[InstantSplat](https://github.com/yindaheng98/InstantSplat):
|
|
94
99
|
|
|
95
100
|
```bash
|
|
96
101
|
python -m nvs2colmap.n3dv \
|
|
@@ -105,7 +110,8 @@ python -m nvs2colmap.n3dv \
|
|
|
105
110
|
```
|
|
106
111
|
|
|
107
112
|
Link a Dynamic 3D Gaussians scene, including its masks, and write per-frame
|
|
108
|
-
COLMAP text models
|
|
113
|
+
COLMAP text models for
|
|
114
|
+
[InstantSplat](https://github.com/yindaheng98/InstantSplat):
|
|
109
115
|
|
|
110
116
|
```bash
|
|
111
117
|
python -m nvs2colmap.dynamic3dgs \
|
|
@@ -116,16 +122,19 @@ python -m nvs2colmap.dynamic3dgs \
|
|
|
116
122
|
For Neural 3D Video scenes, decoded frames are written to `frame*/images` by
|
|
117
123
|
default, and the command also writes `frame*/sparse/0` text models. With
|
|
118
124
|
`--use-colmap`, decoded frames are written to `frame*/input`, and each frame
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
from source video frame `N`,
|
|
122
|
-
from `N`.
|
|
125
|
+
gets `distorted/sparse/0` plus undistorted `images/`, `sparse/`, and `stereo/`
|
|
126
|
+
for [InstantSplat](https://github.com/yindaheng98/InstantSplat). When
|
|
127
|
+
`--start-number N` is provided, decoding starts from source video frame `N`,
|
|
128
|
+
and the generated folders/images are also numbered from `N`.
|
|
123
129
|
|
|
124
130
|
For Dynamic 3D Gaussians scenes, images from both `train_meta.json` and
|
|
125
131
|
`test_meta.json` are hardlinked into `frame*/images`, and included masks are
|
|
126
132
|
hardlinked into `frame*/image_masks` (`cam01.jpg` pairs with `cam01.jpg.png`).
|
|
127
133
|
`--no-train-camera` and `--no-test-camera` drop one split. The same
|
|
128
|
-
`--use-colmap` switch writes images to `frame*/input
|
|
129
|
-
`frame*/input_mask`, and
|
|
130
|
-
|
|
131
|
-
`
|
|
134
|
+
`--use-colmap` switch writes images to `frame*/input` and masks to
|
|
135
|
+
`frame*/input_mask`, then undistorts them to `images/` and `image_masks/`
|
|
136
|
+
for [InstantSplat](https://github.com/yindaheng98/InstantSplat). That switch
|
|
137
|
+
does not write `init_pt_cld.npz` into `sparse/0/points3D.ply`; the
|
|
138
|
+
reconstructed points stay in `distorted/sparse/0` and the undistorted
|
|
139
|
+
`sparse/`. `--start-number` uses the same 1-based output numbering; source
|
|
140
|
+
file `000000.jpg` is frame `1`.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "nvs2colmap"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.4.1"
|
|
8
8
|
description = "Utilities for converting novel view synthesis datasets to COLMAP format."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{ name = "Howard Yin", email = "yindaheng98@gmail.com" }]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|