From ebceb52f55b3abe493e71173bad67787864497e0 Mon Sep 17 00:00:00 2001 From: Zhan Xu <378803753@qq.com> Date: Thu, 24 Aug 2023 15:30:26 -0700 Subject: [PATCH] =?UTF-8?q?save=20sfm=20depth=20as=20png=20to=20keep=2016b?= =?UTF-8?q?it.=20save=20depth=5Ffile=5Fpath=20as=20relative=E2=80=A6=20(#2?= =?UTF-8?q?317)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit save sfm depth as png to keep 16bit. save depth_file_path as relative path Co-authored-by: Matthew Tancik --- nerfstudio/process_data/colmap_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nerfstudio/process_data/colmap_utils.py b/nerfstudio/process_data/colmap_utils.py index ac15d0937..2322075b5 100644 --- a/nerfstudio/process_data/colmap_utils.py +++ b/nerfstudio/process_data/colmap_utils.py @@ -441,7 +441,7 @@ def colmap_to_json( frame["mask_path"] = camera_mask_path.relative_to(camera_mask_path.parent.parent).as_posix() if image_id_to_depth_path is not None: depth_path = image_id_to_depth_path[im_id] - frame["depth_file_path"] = str(depth_path) + frame["depth_file_path"] = str(depth_path.relative_to(depth_path.parent.parent)) frames.append(frame) if set(cam_id_to_camera.keys()) != {1}: @@ -582,6 +582,8 @@ def create_sfm_depth( out_name = str(im_data.name) depth_path = output_dir / out_name + if depth_path.suffix == ".jpg": + depth_path = depth_path.with_suffix(".png") cv2.imwrite(str(depth_path), depth_img) # type: ignore image_id_to_depth_path[im_id] = depth_path