nvs2colmap 0.3.0__tar.gz → 0.3.2__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.0 → nvs2colmap-0.3.2}/PKG-INFO +5 -3
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/README.md +3 -2
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap/dynamic3dgs/__main__.py +10 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap/dynamic3dgs/link_frames.py +2 -1
- nvs2colmap-0.3.2/nvs2colmap/dynamic3dgs/points.py +25 -0
- nvs2colmap-0.3.2/nvs2colmap/write_pcd.py +35 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap.egg-info/PKG-INFO +5 -3
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap.egg-info/SOURCES.txt +4 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap.egg-info/requires.txt +1 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/pyproject.toml +2 -1
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/LICENSE +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap/__init__.py +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap/colmap.py +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap/dynamic3dgs/camera_meta.py +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap/extract_videos.py +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap/n3dv/__main__.py +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap/n3dv/extract_videos.py +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap/n3dv/poses_bounds.py +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap/stnerf/__init__.py +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap/utils/__init__.py +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap/utils/colmap.py +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap/utils/ffmpeg.py +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap/utils/rotation.py +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap/write_model.py +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap.egg-info/dependency_links.txt +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap.egg-info/entry_points.txt +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/nvs2colmap.egg-info/top_level.txt +0 -0
- {nvs2colmap-0.3.0 → nvs2colmap-0.3.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nvs2colmap
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
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>
|
|
@@ -23,6 +23,7 @@ Requires-Python: >=3.10
|
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE
|
|
25
25
|
Requires-Dist: numpy
|
|
26
|
+
Requires-Dist: plyfile
|
|
26
27
|
Requires-Dist: torch
|
|
27
28
|
Dynamic: license-file
|
|
28
29
|
|
|
@@ -60,7 +61,7 @@ Utilities for converting novel view synthesis datasets to COLMAP format.
|
|
|
60
61
|
Install the Python runtime dependencies:
|
|
61
62
|
|
|
62
63
|
```bash
|
|
63
|
-
pip install numpy torch
|
|
64
|
+
pip install numpy plyfile torch
|
|
64
65
|
```
|
|
65
66
|
|
|
66
67
|
For Neural 3D Video scenes, the command also needs `ffmpeg` and `ffprobe` on
|
|
@@ -124,6 +125,7 @@ For Dynamic 3D Gaussians scenes, images from both `train_meta.json` and
|
|
|
124
125
|
`test_meta.json` are hardlinked into `frame*/images`, and included masks are
|
|
125
126
|
hardlinked into `frame*/image_masks` (`cam01.jpg` pairs with `cam01.jpg.png`).
|
|
126
127
|
`--no-train-camera` and `--no-test-camera` drop one split. The same
|
|
127
|
-
`--use-colmap` switch writes images to `frame*/input
|
|
128
|
+
`--use-colmap` switch writes images to `frame*/input`, masks to
|
|
129
|
+
`frame*/input_mask`, and runs COLMAP.
|
|
128
130
|
`--start-number` uses the same 1-based output numbering; source file
|
|
129
131
|
`000000.jpg` is frame `1`.
|
|
@@ -32,7 +32,7 @@ Utilities for converting novel view synthesis datasets to COLMAP format.
|
|
|
32
32
|
Install the Python runtime dependencies:
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
pip install numpy torch
|
|
35
|
+
pip install numpy plyfile torch
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
For Neural 3D Video scenes, the command also needs `ffmpeg` and `ffprobe` on
|
|
@@ -96,6 +96,7 @@ For Dynamic 3D Gaussians scenes, images from both `train_meta.json` and
|
|
|
96
96
|
`test_meta.json` are hardlinked into `frame*/images`, and included masks are
|
|
97
97
|
hardlinked into `frame*/image_masks` (`cam01.jpg` pairs with `cam01.jpg.png`).
|
|
98
98
|
`--no-train-camera` and `--no-test-camera` drop one split. The same
|
|
99
|
-
`--use-colmap` switch writes images to `frame*/input
|
|
99
|
+
`--use-colmap` switch writes images to `frame*/input`, masks to
|
|
100
|
+
`frame*/input_mask`, and runs COLMAP.
|
|
100
101
|
`--start-number` uses the same 1-based output numbering; source file
|
|
101
102
|
`000000.jpg` is frame `1`.
|
|
@@ -10,6 +10,7 @@ from nvs2colmap.write_model import write_video_colmap_text_model
|
|
|
10
10
|
|
|
11
11
|
from .camera_meta import read_camera_meta
|
|
12
12
|
from .link_frames import count_frame_dirs, link_frames
|
|
13
|
+
from .points import write_init_point_cloud
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
def parse_args() -> argparse.Namespace:
|
|
@@ -89,6 +90,7 @@ def main() -> None:
|
|
|
89
90
|
n_frames = args.n_frames
|
|
90
91
|
frame_output_pattern = folder / "frame%d"
|
|
91
92
|
image_dir_name = "input" if args.use_colmap else "images"
|
|
93
|
+
mask_dir_name = "input_mask" if args.use_colmap else "image_masks"
|
|
92
94
|
if not args.skip_frame_linking:
|
|
93
95
|
if n_frames is None:
|
|
94
96
|
n_frames = available_frames - args.start_number + 1
|
|
@@ -99,6 +101,7 @@ def main() -> None:
|
|
|
99
101
|
n_frames=n_frames,
|
|
100
102
|
start_number=args.start_number,
|
|
101
103
|
image_dirname=image_dir_name,
|
|
104
|
+
mask_dirname=mask_dir_name,
|
|
102
105
|
)
|
|
103
106
|
elif n_frames is None:
|
|
104
107
|
n_frames = count_frame_dirs(frame_output_pattern, start_number=args.start_number)
|
|
@@ -123,6 +126,13 @@ def main() -> None:
|
|
|
123
126
|
use_gpu=args.colmap_use_gpu,
|
|
124
127
|
)
|
|
125
128
|
|
|
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
|
+
|
|
126
136
|
print(f"Done: {folder}")
|
|
127
137
|
|
|
128
138
|
|
|
@@ -36,6 +36,7 @@ def link_frames(
|
|
|
36
36
|
n_frames: int,
|
|
37
37
|
start_number: int = 1,
|
|
38
38
|
image_dirname: str = "images",
|
|
39
|
+
mask_dirname: str = "image_masks",
|
|
39
40
|
) -> None:
|
|
40
41
|
folder = Path(folder)
|
|
41
42
|
frame_pattern = str(frame_pattern)
|
|
@@ -43,7 +44,7 @@ def link_frames(
|
|
|
43
44
|
frame_index = start_number - 1 + offset
|
|
44
45
|
frame_dir = Path(frame_pattern % (start_number + offset))
|
|
45
46
|
image_dir = frame_dir / image_dirname
|
|
46
|
-
mask_dir = frame_dir /
|
|
47
|
+
mask_dir = frame_dir / mask_dirname
|
|
47
48
|
for camera in cameras:
|
|
48
49
|
filename = camera.filenames[frame_index]
|
|
49
50
|
link_file(folder / "ims" / filename, image_dir / camera.camera.name)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Write Dynamic 3D Gaussians init_pt_cld.npz as COLMAP points3D.ply."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
|
|
9
|
+
from nvs2colmap.write_pcd import write_pcd
|
|
10
|
+
|
|
11
|
+
from .link_frames import link_file
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def write_init_point_cloud(
|
|
15
|
+
npz_path: Path,
|
|
16
|
+
output_pattern: Path,
|
|
17
|
+
n_frames: int,
|
|
18
|
+
start_number: int = 1,
|
|
19
|
+
) -> None:
|
|
20
|
+
data = np.load(npz_path)["data"]
|
|
21
|
+
output_pattern = str(output_pattern)
|
|
22
|
+
paths = [Path(output_pattern % frame) for frame in range(start_number, start_number + n_frames)]
|
|
23
|
+
write_pcd(paths[0], data[:, :3], data[:, 3:6] * 255.0)
|
|
24
|
+
for path in paths[1:]:
|
|
25
|
+
link_file(paths[0], path)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Write xyz/rgb point clouds as PLY files."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
from plyfile import PlyData, PlyElement
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def write_pcd(path, points, colors) -> None:
|
|
10
|
+
"""Write a point cloud in the InstantSplat ``points3D.ply`` layout.
|
|
11
|
+
|
|
12
|
+
``points`` and ``colors`` are ``(N, 3)`` arrays. Colors are already 8-bit
|
|
13
|
+
RGB values in ``[0, 255]``.
|
|
14
|
+
"""
|
|
15
|
+
xyz = np.asarray(points)
|
|
16
|
+
rgb = np.asarray(colors)
|
|
17
|
+
dtype = [
|
|
18
|
+
("x", "f4"),
|
|
19
|
+
("y", "f4"),
|
|
20
|
+
("z", "f4"),
|
|
21
|
+
("nx", "f4"),
|
|
22
|
+
("ny", "f4"),
|
|
23
|
+
("nz", "f4"),
|
|
24
|
+
("red", "u1"),
|
|
25
|
+
("green", "u1"),
|
|
26
|
+
("blue", "u1"),
|
|
27
|
+
]
|
|
28
|
+
normals = np.zeros_like(xyz)
|
|
29
|
+
elements = np.empty(xyz.shape[0], dtype=dtype)
|
|
30
|
+
attributes = np.concatenate((xyz, normals, rgb), axis=1)
|
|
31
|
+
elements[:] = list(map(tuple, attributes))
|
|
32
|
+
|
|
33
|
+
path = Path(path)
|
|
34
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
35
|
+
PlyData([PlyElement.describe(elements, "vertex")]).write(path)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nvs2colmap
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
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>
|
|
@@ -23,6 +23,7 @@ Requires-Python: >=3.10
|
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE
|
|
25
25
|
Requires-Dist: numpy
|
|
26
|
+
Requires-Dist: plyfile
|
|
26
27
|
Requires-Dist: torch
|
|
27
28
|
Dynamic: license-file
|
|
28
29
|
|
|
@@ -60,7 +61,7 @@ Utilities for converting novel view synthesis datasets to COLMAP format.
|
|
|
60
61
|
Install the Python runtime dependencies:
|
|
61
62
|
|
|
62
63
|
```bash
|
|
63
|
-
pip install numpy torch
|
|
64
|
+
pip install numpy plyfile torch
|
|
64
65
|
```
|
|
65
66
|
|
|
66
67
|
For Neural 3D Video scenes, the command also needs `ffmpeg` and `ffprobe` on
|
|
@@ -124,6 +125,7 @@ For Dynamic 3D Gaussians scenes, images from both `train_meta.json` and
|
|
|
124
125
|
`test_meta.json` are hardlinked into `frame*/images`, and included masks are
|
|
125
126
|
hardlinked into `frame*/image_masks` (`cam01.jpg` pairs with `cam01.jpg.png`).
|
|
126
127
|
`--no-train-camera` and `--no-test-camera` drop one split. The same
|
|
127
|
-
`--use-colmap` switch writes images to `frame*/input
|
|
128
|
+
`--use-colmap` switch writes images to `frame*/input`, masks to
|
|
129
|
+
`frame*/input_mask`, and runs COLMAP.
|
|
128
130
|
`--start-number` uses the same 1-based output numbering; source file
|
|
129
131
|
`000000.jpg` is frame `1`.
|
|
@@ -5,9 +5,11 @@ pyproject.toml
|
|
|
5
5
|
./nvs2colmap/colmap.py
|
|
6
6
|
./nvs2colmap/extract_videos.py
|
|
7
7
|
./nvs2colmap/write_model.py
|
|
8
|
+
./nvs2colmap/write_pcd.py
|
|
8
9
|
./nvs2colmap/dynamic3dgs/__main__.py
|
|
9
10
|
./nvs2colmap/dynamic3dgs/camera_meta.py
|
|
10
11
|
./nvs2colmap/dynamic3dgs/link_frames.py
|
|
12
|
+
./nvs2colmap/dynamic3dgs/points.py
|
|
11
13
|
./nvs2colmap/n3dv/__main__.py
|
|
12
14
|
./nvs2colmap/n3dv/extract_videos.py
|
|
13
15
|
./nvs2colmap/n3dv/poses_bounds.py
|
|
@@ -20,6 +22,7 @@ nvs2colmap/__init__.py
|
|
|
20
22
|
nvs2colmap/colmap.py
|
|
21
23
|
nvs2colmap/extract_videos.py
|
|
22
24
|
nvs2colmap/write_model.py
|
|
25
|
+
nvs2colmap/write_pcd.py
|
|
23
26
|
nvs2colmap.egg-info/PKG-INFO
|
|
24
27
|
nvs2colmap.egg-info/SOURCES.txt
|
|
25
28
|
nvs2colmap.egg-info/dependency_links.txt
|
|
@@ -29,6 +32,7 @@ nvs2colmap.egg-info/top_level.txt
|
|
|
29
32
|
nvs2colmap/dynamic3dgs/__main__.py
|
|
30
33
|
nvs2colmap/dynamic3dgs/camera_meta.py
|
|
31
34
|
nvs2colmap/dynamic3dgs/link_frames.py
|
|
35
|
+
nvs2colmap/dynamic3dgs/points.py
|
|
32
36
|
nvs2colmap/n3dv/__main__.py
|
|
33
37
|
nvs2colmap/n3dv/extract_videos.py
|
|
34
38
|
nvs2colmap/n3dv/poses_bounds.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "nvs2colmap"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.2"
|
|
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" }]
|
|
@@ -12,6 +12,7 @@ maintainers = [{ name = "Howard Yin", email = "yindaheng98@gmail.com" }]
|
|
|
12
12
|
requires-python = ">=3.10"
|
|
13
13
|
dependencies = [
|
|
14
14
|
"numpy",
|
|
15
|
+
"plyfile",
|
|
15
16
|
"torch",
|
|
16
17
|
]
|
|
17
18
|
keywords = [
|
|
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
|