nvs2colmap 0.6.0__tar.gz → 0.7.0__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.6.0 → nvs2colmap-0.7.0}/PKG-INFO +78 -5
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/README.md +78 -5
- nvs2colmap-0.7.0/nvs2colmap/SiggraphAsia2026VVC/__main__.py +165 -0
- nvs2colmap-0.7.0/nvs2colmap/SiggraphAsia2026VVC/cameras.py +313 -0
- nvs2colmap-0.7.0/nvs2colmap/SiggraphAsia2026VVC/link_frames.py +113 -0
- nvs2colmap-0.7.0/nvs2colmap/SiggraphAsia2026VVC/points.py +43 -0
- nvs2colmap-0.7.0/nvs2colmap/SiggraphAsia2026VVC/undistort.py +80 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/stnerf/__main__.py +12 -13
- nvs2colmap-0.7.0/nvs2colmap/stnerf/extract.py +86 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/stnerf/pose.py +2 -10
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap.egg-info/PKG-INFO +78 -5
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap.egg-info/SOURCES.txt +12 -2
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap.egg-info/entry_points.txt +1 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/pyproject.toml +2 -1
- nvs2colmap-0.6.0/nvs2colmap/stnerf/link_frames.py +0 -49
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/LICENSE +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/__init__.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/blender/__main__.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/blender/preview_cameras.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/blender/render.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/blender/sample_cameras.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/colmap.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/dynamic3dgs/__main__.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/dynamic3dgs/camera_meta.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/dynamic3dgs/link_frames.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/dynamic3dgs/points.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/extract_videos.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/n3dv/__main__.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/n3dv/extract_videos.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/n3dv/poses_bounds.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/stnerf/__init__.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/utils/__init__.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/utils/colmap.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/utils/ffmpeg.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/utils/rotation.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/write_model.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap/write_pcd.py +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap.egg-info/dependency_links.txt +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap.egg-info/requires.txt +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/nvs2colmap.egg-info/top_level.txt +0 -0
- {nvs2colmap-0.6.0 → nvs2colmap-0.7.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nvs2colmap
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
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>
|
|
@@ -42,6 +42,12 @@ Utilities for converting novel view synthesis datasets to COLMAP format.
|
|
|
42
42
|
- **Blender**: a `.blend` file rendered into that Neural 3D Video layout, with
|
|
43
43
|
`blender_frames.json` recording the Blender timeline frame of each video
|
|
44
44
|
frame. See `nvs2colmap/blender/README.md`.
|
|
45
|
+
- **ST-NeRF**: scenes with `pose/K.txt`, `pose/RT_c2w.txt`, and one
|
|
46
|
+
`frame*/images` folder per frame. The released `boxing` archive has no
|
|
47
|
+
`pose/`. See `nvs2colmap/stnerf/README.md`.
|
|
48
|
+
- **Siggraph Asia 2026 VVC**: scenes with `images/<view>/<frame>`,
|
|
49
|
+
`train_intri.yml`, and `train_extri.yml`. See
|
|
50
|
+
`nvs2colmap/SiggraphAsia2026VVC/README.md`.
|
|
45
51
|
|
|
46
52
|
## Supported Datasets
|
|
47
53
|
|
|
@@ -60,6 +66,12 @@ Utilities for converting novel view synthesis datasets to COLMAP format.
|
|
|
60
66
|
[JonathonLuiten/Dynamic3DGaussians](https://github.com/JonathonLuiten/Dynamic3DGaussians),
|
|
61
67
|
paper
|
|
62
68
|
[Dynamic 3D Gaussians: Tracking by Persistent Dynamic View Synthesis](https://arxiv.org/abs/2308.09713).
|
|
69
|
+
- **ST-NeRF**: code
|
|
70
|
+
[DarlingHang/ST-NeRF](https://github.com/DarlingHang/ST-NeRF),
|
|
71
|
+
paper
|
|
72
|
+
[Editable Free-Viewpoint Video using a Layered Neural Representation](https://arxiv.org/abs/2104.14786).
|
|
73
|
+
- **Siggraph Asia 2026 VVC**: dataset
|
|
74
|
+
[zju3dv/SiggraphAsia2026VVC](https://huggingface.co/datasets/zju3dv/SiggraphAsia2026VVC).
|
|
63
75
|
|
|
64
76
|
## Quick Start
|
|
65
77
|
|
|
@@ -69,11 +81,29 @@ Install the Python runtime dependencies:
|
|
|
69
81
|
pip install numpy plyfile torch
|
|
70
82
|
```
|
|
71
83
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
84
|
+
Download FFmpeg 7.0.2-static and place `ffmpeg` and `ffprobe` in `data/`:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
mkdir -p data
|
|
88
|
+
wget -qO- https://johnvansickle.com/ffmpeg/releases/ffmpeg-7.0.2-amd64-static.tar.xz | tar -xJ -C data --strip-components=1 ffmpeg-7.0.2-amd64-static/ffmpeg ffmpeg-7.0.2-amd64-static/ffprobe
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Install COLMAP from conda-forge:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
conda install -c conda-forge colmap
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The `colmap` executable is installed into the conda environment. Activate
|
|
98
|
+
that environment before a `--use-colmap` run. Activation puts `colmap` on
|
|
99
|
+
`PATH` and loads the shared libraries the executable links against. A Python
|
|
100
|
+
virtualenv such as `.venv` can be activated afterwards so its `python` stays
|
|
101
|
+
first on `PATH`.
|
|
102
|
+
|
|
103
|
+
For Neural 3D Video scenes, pass `data/ffmpeg` and `data/ffprobe`, or put
|
|
104
|
+
`ffmpeg` and `ffprobe` on `PATH`. To run the COLMAP reconstruction that
|
|
75
105
|
[InstantSplat](https://github.com/yindaheng98/InstantSplat) continues from,
|
|
76
|
-
|
|
106
|
+
pass `--colmap-executable colmap` after the conda environment is active.
|
|
77
107
|
|
|
78
108
|
Extract a Neural 3D Video scene and write per-frame COLMAP text models for
|
|
79
109
|
[InstantSplat](https://github.com/yindaheng98/InstantSplat):
|
|
@@ -101,6 +131,7 @@ Run COLMAP reconstruction and undistortion for each frame, for
|
|
|
101
131
|
[InstantSplat](https://github.com/yindaheng98/InstantSplat):
|
|
102
132
|
|
|
103
133
|
```bash
|
|
134
|
+
conda activate
|
|
104
135
|
python -m nvs2colmap.n3dv \
|
|
105
136
|
--path data/Robo360/xarm6_gold_rope_in_basket_2 \
|
|
106
137
|
--ffmpeg ffmpeg \
|
|
@@ -122,6 +153,26 @@ python -m nvs2colmap.dynamic3dgs \
|
|
|
122
153
|
--n-frames 150
|
|
123
154
|
```
|
|
124
155
|
|
|
156
|
+
Write per-frame COLMAP text models for an ST-NeRF scene. The scene must
|
|
157
|
+
contain `pose/K.txt` and `pose/RT_c2w.txt`:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
python -m nvs2colmap.stnerf \
|
|
161
|
+
--path data/taekwondo \
|
|
162
|
+
--n-frames 101
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Link a Siggraph Asia 2026 VVC scene and write per-frame COLMAP text models
|
|
166
|
+
for [InstantSplat](https://github.com/yindaheng98/InstantSplat). The default
|
|
167
|
+
starts at the first frame file, so `selfcap` `000900.jpg` is `frame901`:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
python -m nvs2colmap.SiggraphAsia2026VVC \
|
|
171
|
+
--path data/SiggraphAsia2026VVC/siga/compression/test/004_1_seq1
|
|
172
|
+
python -m nvs2colmap.SiggraphAsia2026VVC \
|
|
173
|
+
--path data/SiggraphAsia2026VVC/selfcap/sparse/test/0512_bike
|
|
174
|
+
```
|
|
175
|
+
|
|
125
176
|
Render a `.blend` file into camera videos next to an existing
|
|
126
177
|
`poses_bounds.npy`. `blender` must be on `PATH`, or pass the executable with
|
|
127
178
|
`--blender`:
|
|
@@ -153,6 +204,20 @@ reconstructed points stay in `distorted/sparse/0` and the undistorted
|
|
|
153
204
|
`sparse/`. `--start-number` uses the same 1-based output numbering; source
|
|
154
205
|
file `000000.jpg` is frame `1`.
|
|
155
206
|
|
|
207
|
+
For Siggraph Asia 2026 VVC scenes, images from `train_intri.yml` /
|
|
208
|
+
`train_extri.yml` and, when present, `test_intri.yml` / `test_extri.yml` are
|
|
209
|
+
placed in `frame*/images`. Included masks go in `frame*/image_masks`
|
|
210
|
+
(`0002.jpg` pairs with `0002.jpg.png`). A zero `D_<view>` is hardlinked. A
|
|
211
|
+
nonzero `D_<view>` hardlinks the original into `frame*/input`. COLMAP's
|
|
212
|
+
`image_undistorter` writes `frame*/images` and a `PINHOLE` model in
|
|
213
|
+
`sparse/0`. A shared `pcds/000000.ply` is hardlinked to `sparse/0/points3D.ply`
|
|
214
|
+
in every extracted frame. `--use-colmap` writes images to `frame*/input` and
|
|
215
|
+
masks to `frame*/input_mask`, then runs COLMAP undistortion into `images/` and
|
|
216
|
+
`image_masks/` for
|
|
217
|
+
[InstantSplat](https://github.com/yindaheng98/InstantSplat). The default
|
|
218
|
+
starts at the first frame file. Source file `000000.jpg` is frame `1`, and
|
|
219
|
+
`000900.jpg` is frame `901`.
|
|
220
|
+
|
|
156
221
|
For Blender scenes, rendering writes one video per camera beside
|
|
157
222
|
`poses_bounds.npy`, plus `blender_frames.json` in that same directory. The
|
|
158
223
|
file is a JSON list of Blender timeline frame numbers in render order. Video
|
|
@@ -161,3 +226,11 @@ frame `i` (1-based) is Blender frame `blender_frames[i - 1]`.
|
|
|
161
226
|
the `.blend` timeline. With `--frame_step 3`, the file begins `[1, 4, 7, ...]`.
|
|
162
227
|
Decoding the videos with `python -m nvs2colmap.n3dv` numbers `frame*` folders
|
|
163
228
|
by video frame, so `frameK` is `blender_frames[K - 1]`.
|
|
229
|
+
|
|
230
|
+
For ST-NeRF scenes, the scene directory holds one zip file. The default
|
|
231
|
+
command extracts images to `frame*/images` and writes `frame*/sparse/0` text
|
|
232
|
+
models from `pose/K.txt` and `pose/RT_c2w.txt`. `--use-colmap` extracts images
|
|
233
|
+
to `frame*/input`, then undistorts them to `images/` for
|
|
234
|
+
[InstantSplat](https://github.com/yindaheng98/InstantSplat). A scene without
|
|
235
|
+
`pose/` raises an error. `--start-number` uses the same 1-based numbering;
|
|
236
|
+
source directory `frame1` is frame `1`.
|
|
@@ -13,6 +13,12 @@ Utilities for converting novel view synthesis datasets to COLMAP format.
|
|
|
13
13
|
- **Blender**: a `.blend` file rendered into that Neural 3D Video layout, with
|
|
14
14
|
`blender_frames.json` recording the Blender timeline frame of each video
|
|
15
15
|
frame. See `nvs2colmap/blender/README.md`.
|
|
16
|
+
- **ST-NeRF**: scenes with `pose/K.txt`, `pose/RT_c2w.txt`, and one
|
|
17
|
+
`frame*/images` folder per frame. The released `boxing` archive has no
|
|
18
|
+
`pose/`. See `nvs2colmap/stnerf/README.md`.
|
|
19
|
+
- **Siggraph Asia 2026 VVC**: scenes with `images/<view>/<frame>`,
|
|
20
|
+
`train_intri.yml`, and `train_extri.yml`. See
|
|
21
|
+
`nvs2colmap/SiggraphAsia2026VVC/README.md`.
|
|
16
22
|
|
|
17
23
|
## Supported Datasets
|
|
18
24
|
|
|
@@ -31,6 +37,12 @@ Utilities for converting novel view synthesis datasets to COLMAP format.
|
|
|
31
37
|
[JonathonLuiten/Dynamic3DGaussians](https://github.com/JonathonLuiten/Dynamic3DGaussians),
|
|
32
38
|
paper
|
|
33
39
|
[Dynamic 3D Gaussians: Tracking by Persistent Dynamic View Synthesis](https://arxiv.org/abs/2308.09713).
|
|
40
|
+
- **ST-NeRF**: code
|
|
41
|
+
[DarlingHang/ST-NeRF](https://github.com/DarlingHang/ST-NeRF),
|
|
42
|
+
paper
|
|
43
|
+
[Editable Free-Viewpoint Video using a Layered Neural Representation](https://arxiv.org/abs/2104.14786).
|
|
44
|
+
- **Siggraph Asia 2026 VVC**: dataset
|
|
45
|
+
[zju3dv/SiggraphAsia2026VVC](https://huggingface.co/datasets/zju3dv/SiggraphAsia2026VVC).
|
|
34
46
|
|
|
35
47
|
## Quick Start
|
|
36
48
|
|
|
@@ -40,11 +52,29 @@ Install the Python runtime dependencies:
|
|
|
40
52
|
pip install numpy plyfile torch
|
|
41
53
|
```
|
|
42
54
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
Download FFmpeg 7.0.2-static and place `ffmpeg` and `ffprobe` in `data/`:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
mkdir -p data
|
|
59
|
+
wget -qO- https://johnvansickle.com/ffmpeg/releases/ffmpeg-7.0.2-amd64-static.tar.xz | tar -xJ -C data --strip-components=1 ffmpeg-7.0.2-amd64-static/ffmpeg ffmpeg-7.0.2-amd64-static/ffprobe
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Install COLMAP from conda-forge:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
conda install -c conda-forge colmap
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The `colmap` executable is installed into the conda environment. Activate
|
|
69
|
+
that environment before a `--use-colmap` run. Activation puts `colmap` on
|
|
70
|
+
`PATH` and loads the shared libraries the executable links against. A Python
|
|
71
|
+
virtualenv such as `.venv` can be activated afterwards so its `python` stays
|
|
72
|
+
first on `PATH`.
|
|
73
|
+
|
|
74
|
+
For Neural 3D Video scenes, pass `data/ffmpeg` and `data/ffprobe`, or put
|
|
75
|
+
`ffmpeg` and `ffprobe` on `PATH`. To run the COLMAP reconstruction that
|
|
46
76
|
[InstantSplat](https://github.com/yindaheng98/InstantSplat) continues from,
|
|
47
|
-
|
|
77
|
+
pass `--colmap-executable colmap` after the conda environment is active.
|
|
48
78
|
|
|
49
79
|
Extract a Neural 3D Video scene and write per-frame COLMAP text models for
|
|
50
80
|
[InstantSplat](https://github.com/yindaheng98/InstantSplat):
|
|
@@ -72,6 +102,7 @@ Run COLMAP reconstruction and undistortion for each frame, for
|
|
|
72
102
|
[InstantSplat](https://github.com/yindaheng98/InstantSplat):
|
|
73
103
|
|
|
74
104
|
```bash
|
|
105
|
+
conda activate
|
|
75
106
|
python -m nvs2colmap.n3dv \
|
|
76
107
|
--path data/Robo360/xarm6_gold_rope_in_basket_2 \
|
|
77
108
|
--ffmpeg ffmpeg \
|
|
@@ -93,6 +124,26 @@ python -m nvs2colmap.dynamic3dgs \
|
|
|
93
124
|
--n-frames 150
|
|
94
125
|
```
|
|
95
126
|
|
|
127
|
+
Write per-frame COLMAP text models for an ST-NeRF scene. The scene must
|
|
128
|
+
contain `pose/K.txt` and `pose/RT_c2w.txt`:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
python -m nvs2colmap.stnerf \
|
|
132
|
+
--path data/taekwondo \
|
|
133
|
+
--n-frames 101
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Link a Siggraph Asia 2026 VVC scene and write per-frame COLMAP text models
|
|
137
|
+
for [InstantSplat](https://github.com/yindaheng98/InstantSplat). The default
|
|
138
|
+
starts at the first frame file, so `selfcap` `000900.jpg` is `frame901`:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
python -m nvs2colmap.SiggraphAsia2026VVC \
|
|
142
|
+
--path data/SiggraphAsia2026VVC/siga/compression/test/004_1_seq1
|
|
143
|
+
python -m nvs2colmap.SiggraphAsia2026VVC \
|
|
144
|
+
--path data/SiggraphAsia2026VVC/selfcap/sparse/test/0512_bike
|
|
145
|
+
```
|
|
146
|
+
|
|
96
147
|
Render a `.blend` file into camera videos next to an existing
|
|
97
148
|
`poses_bounds.npy`. `blender` must be on `PATH`, or pass the executable with
|
|
98
149
|
`--blender`:
|
|
@@ -124,6 +175,20 @@ reconstructed points stay in `distorted/sparse/0` and the undistorted
|
|
|
124
175
|
`sparse/`. `--start-number` uses the same 1-based output numbering; source
|
|
125
176
|
file `000000.jpg` is frame `1`.
|
|
126
177
|
|
|
178
|
+
For Siggraph Asia 2026 VVC scenes, images from `train_intri.yml` /
|
|
179
|
+
`train_extri.yml` and, when present, `test_intri.yml` / `test_extri.yml` are
|
|
180
|
+
placed in `frame*/images`. Included masks go in `frame*/image_masks`
|
|
181
|
+
(`0002.jpg` pairs with `0002.jpg.png`). A zero `D_<view>` is hardlinked. A
|
|
182
|
+
nonzero `D_<view>` hardlinks the original into `frame*/input`. COLMAP's
|
|
183
|
+
`image_undistorter` writes `frame*/images` and a `PINHOLE` model in
|
|
184
|
+
`sparse/0`. A shared `pcds/000000.ply` is hardlinked to `sparse/0/points3D.ply`
|
|
185
|
+
in every extracted frame. `--use-colmap` writes images to `frame*/input` and
|
|
186
|
+
masks to `frame*/input_mask`, then runs COLMAP undistortion into `images/` and
|
|
187
|
+
`image_masks/` for
|
|
188
|
+
[InstantSplat](https://github.com/yindaheng98/InstantSplat). The default
|
|
189
|
+
starts at the first frame file. Source file `000000.jpg` is frame `1`, and
|
|
190
|
+
`000900.jpg` is frame `901`.
|
|
191
|
+
|
|
127
192
|
For Blender scenes, rendering writes one video per camera beside
|
|
128
193
|
`poses_bounds.npy`, plus `blender_frames.json` in that same directory. The
|
|
129
194
|
file is a JSON list of Blender timeline frame numbers in render order. Video
|
|
@@ -131,4 +196,12 @@ frame `i` (1-based) is Blender frame `blender_frames[i - 1]`.
|
|
|
131
196
|
`--frame_start` defaults to `1`. `--frame_end` and `--frame_step` default to
|
|
132
197
|
the `.blend` timeline. With `--frame_step 3`, the file begins `[1, 4, 7, ...]`.
|
|
133
198
|
Decoding the videos with `python -m nvs2colmap.n3dv` numbers `frame*` folders
|
|
134
|
-
by video frame, so `frameK` is `blender_frames[K - 1]`.
|
|
199
|
+
by video frame, so `frameK` is `blender_frames[K - 1]`.
|
|
200
|
+
|
|
201
|
+
For ST-NeRF scenes, the scene directory holds one zip file. The default
|
|
202
|
+
command extracts images to `frame*/images` and writes `frame*/sparse/0` text
|
|
203
|
+
models from `pose/K.txt` and `pose/RT_c2w.txt`. `--use-colmap` extracts images
|
|
204
|
+
to `frame*/input`, then undistorts them to `images/` for
|
|
205
|
+
[InstantSplat](https://github.com/yindaheng98/InstantSplat). A scene without
|
|
206
|
+
`pose/` raises an error. `--start-number` uses the same 1-based numbering;
|
|
207
|
+
source directory `frame1` is frame `1`.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"""Extract Siggraph Asia 2026 VVC scenes into per-frame COLMAP folders."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from nvs2colmap.colmap import run_video_colmap
|
|
9
|
+
from nvs2colmap.write_model import write_video_colmap_text_model
|
|
10
|
+
|
|
11
|
+
from .cameras import read_camera_meta
|
|
12
|
+
from .link_frames import count_frame_dirs, first_frame_number, link_frames, select_frame_indices
|
|
13
|
+
from .points import link_point_clouds
|
|
14
|
+
from .undistort import undistort_frames
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def parse_args() -> argparse.Namespace:
|
|
18
|
+
parser = argparse.ArgumentParser(
|
|
19
|
+
description=(
|
|
20
|
+
"Extract a Siggraph Asia 2026 VVC scene and convert train/test "
|
|
21
|
+
"camera YAML to per-frame COLMAP text models."
|
|
22
|
+
)
|
|
23
|
+
)
|
|
24
|
+
parser.add_argument(
|
|
25
|
+
"--path",
|
|
26
|
+
type=Path,
|
|
27
|
+
required=True,
|
|
28
|
+
help="Scene directory containing images/, train_intri.yml, and train_extri.yml.",
|
|
29
|
+
)
|
|
30
|
+
parser.add_argument(
|
|
31
|
+
"--n-frames",
|
|
32
|
+
type=int,
|
|
33
|
+
help=(
|
|
34
|
+
"Number of frames to extract and write. Defaults to every frame from "
|
|
35
|
+
"--start-number through the last frame."
|
|
36
|
+
),
|
|
37
|
+
)
|
|
38
|
+
parser.add_argument(
|
|
39
|
+
"--start-number",
|
|
40
|
+
type=int,
|
|
41
|
+
help=(
|
|
42
|
+
"1-based source frame to start from. Defaults to the first frame file. "
|
|
43
|
+
"Source file 000000.jpg is frame 1, and 000900.jpg is frame 901."
|
|
44
|
+
),
|
|
45
|
+
)
|
|
46
|
+
parser.add_argument(
|
|
47
|
+
"--no-train-camera",
|
|
48
|
+
action="store_true",
|
|
49
|
+
help="Do not extract cameras listed in train_intri.yml and train_extri.yml.",
|
|
50
|
+
)
|
|
51
|
+
parser.add_argument(
|
|
52
|
+
"--no-test-camera",
|
|
53
|
+
action="store_true",
|
|
54
|
+
help="Do not extract cameras listed in test_intri.yml and test_extri.yml.",
|
|
55
|
+
)
|
|
56
|
+
parser.add_argument(
|
|
57
|
+
"--skip-frame-linking",
|
|
58
|
+
action="store_true",
|
|
59
|
+
help="Only convert camera YAML for existing frame folders.",
|
|
60
|
+
)
|
|
61
|
+
parser.add_argument(
|
|
62
|
+
"--use-colmap",
|
|
63
|
+
action="store_true",
|
|
64
|
+
help=(
|
|
65
|
+
"Run COLMAP feature extraction, matching, triangulation, mapping, "
|
|
66
|
+
"and undistortion of images and masks instead of only writing sparse/0 text models."
|
|
67
|
+
),
|
|
68
|
+
)
|
|
69
|
+
parser.add_argument(
|
|
70
|
+
"--colmap-executable",
|
|
71
|
+
default="colmap",
|
|
72
|
+
help=(
|
|
73
|
+
"COLMAP executable. Views with nonzero distortion are undistorted with it, "
|
|
74
|
+
"and --use-colmap uses it for the full pipeline."
|
|
75
|
+
),
|
|
76
|
+
)
|
|
77
|
+
parser.add_argument(
|
|
78
|
+
"--colmap-use-gpu",
|
|
79
|
+
dest="colmap_use_gpu",
|
|
80
|
+
default="1",
|
|
81
|
+
help="Whether COLMAP SIFT extraction/matching should use GPU when --use-colmap is set.",
|
|
82
|
+
)
|
|
83
|
+
args = parser.parse_args()
|
|
84
|
+
if args.no_train_camera and args.no_test_camera:
|
|
85
|
+
parser.error("Cannot set both --no-train-camera and --no-test-camera.")
|
|
86
|
+
if args.n_frames is not None and args.n_frames < 1:
|
|
87
|
+
parser.error("--n-frames must be at least 1.")
|
|
88
|
+
if args.start_number is not None and args.start_number < 1:
|
|
89
|
+
parser.error("--start-number must be at least 1.")
|
|
90
|
+
return args
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def main() -> None:
|
|
94
|
+
args = parse_args()
|
|
95
|
+
folder = args.path.resolve()
|
|
96
|
+
|
|
97
|
+
cameras, available_frames = read_camera_meta(
|
|
98
|
+
folder,
|
|
99
|
+
include_train=not args.no_train_camera,
|
|
100
|
+
include_test=not args.no_test_camera,
|
|
101
|
+
)
|
|
102
|
+
if args.skip_frame_linking:
|
|
103
|
+
start_number = args.start_number or first_frame_number(folder)
|
|
104
|
+
n_frames = args.n_frames
|
|
105
|
+
if n_frames is None:
|
|
106
|
+
n_frames = count_frame_dirs(folder / "frame%d", start_number=start_number)
|
|
107
|
+
frame_indices = list(range(start_number - 1, start_number - 1 + n_frames))
|
|
108
|
+
else:
|
|
109
|
+
frame_indices = select_frame_indices(available_frames, args.start_number, args.n_frames)
|
|
110
|
+
|
|
111
|
+
frame_output_pattern = folder / "frame%d"
|
|
112
|
+
distorted = any(camera.dist is not None for camera in cameras)
|
|
113
|
+
image_dir_name = "input" if args.use_colmap else "images"
|
|
114
|
+
mask_dir_name = "input_mask" if args.use_colmap else "image_masks"
|
|
115
|
+
if not args.skip_frame_linking:
|
|
116
|
+
link_frames(
|
|
117
|
+
folder=folder,
|
|
118
|
+
frame_pattern=frame_output_pattern,
|
|
119
|
+
cameras=cameras,
|
|
120
|
+
frame_indices=frame_indices,
|
|
121
|
+
image_dirname=image_dir_name,
|
|
122
|
+
mask_dirname=mask_dir_name,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
colmap_cameras = [camera.camera for camera in cameras]
|
|
126
|
+
n_frames = len(frame_indices)
|
|
127
|
+
start_number = frame_indices[0] + 1
|
|
128
|
+
if not args.use_colmap:
|
|
129
|
+
if distorted:
|
|
130
|
+
if not args.skip_frame_linking:
|
|
131
|
+
undistort_frames(
|
|
132
|
+
frame_pattern=frame_output_pattern,
|
|
133
|
+
cameras=cameras,
|
|
134
|
+
frame_indices=frame_indices,
|
|
135
|
+
colmap_executable=args.colmap_executable,
|
|
136
|
+
)
|
|
137
|
+
else:
|
|
138
|
+
write_video_colmap_text_model(
|
|
139
|
+
output_pattern=frame_output_pattern / "sparse" / "0",
|
|
140
|
+
cameras=colmap_cameras,
|
|
141
|
+
n_frames=n_frames,
|
|
142
|
+
start_number=start_number,
|
|
143
|
+
image_extension="",
|
|
144
|
+
)
|
|
145
|
+
link_point_clouds(
|
|
146
|
+
folder=folder,
|
|
147
|
+
output_pattern=frame_output_pattern / "sparse" / "0" / "points3D.ply",
|
|
148
|
+
frame_indices=frame_indices,
|
|
149
|
+
)
|
|
150
|
+
else:
|
|
151
|
+
run_video_colmap(
|
|
152
|
+
output_pattern=frame_output_pattern,
|
|
153
|
+
cameras=colmap_cameras,
|
|
154
|
+
n_frames=n_frames,
|
|
155
|
+
start_number=start_number,
|
|
156
|
+
image_extension="",
|
|
157
|
+
colmap_executable=args.colmap_executable,
|
|
158
|
+
use_gpu=args.colmap_use_gpu,
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
print(f"Done: {folder}")
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
if __name__ == "__main__":
|
|
165
|
+
main()
|