mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-15 12:23:46 +08:00
Write UTF-8 image names intact in COLMAP binary models
This commit is contained in:
1 parent
50e0e3c70c
commit
6e2c946e0c
2 files changed
+25
-2
No files matched your search
@@ -0,0 +1,24 @@
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
|
||||
from nerfstudio.data.utils.colmap_parsing_utils import Image, read_images_binary, write_images_binary
|
||||
|
||||
|
||||
def test_multibyte_image_name_roundtrip(tmp_path: Path):
|
||||
image = Image(
|
||||
id=7,
|
||||
qvec=np.array([1, 0, 0, 0]),
|
||||
tvec=np.zeros(3),
|
||||
camera_id=3,
|
||||
name="室内/café.png",
|
||||
xys=np.array([[2.5, 1.0]]),
|
||||
point3D_ids=np.array([17]),
|
||||
)
|
||||
path = tmp_path / "images.bin"
|
||||
write_images_binary({image.id: image}, path)
|
||||
restored = read_images_binary(path)[image.id]
|
||||
|
||||
assert restored.name == image.name
|
||||
np.testing.assert_array_equal(restored.xys, image.xys)
|
||||
np.testing.assert_array_equal(restored.point3D_ids, image.point3D_ids)
|
||||
Reference in new issue
Block a user