Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update colmap_dataset.py #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dataio/colmap/colmap_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,15 @@ def get_image(self, scene_id: str, camera_id: str, frame_index: int) -> np.ndarr

def get_mono_depth(self, scene_id: str, camera_id: str, frame_index: int) -> np.ndarray:
assert self.image_mono_depth_dirname is not None, "You should specify image_mono_depth_dirname"
img_name = self.img_names[frame_index]
img_name = self.image_names[frame_index]
fpath = os.path.join(self.data_dir, self.image_mono_depth_dirname, f'{img_name}.npz')
assert os.path.exists(fpath), f"Not exist: {fpath}"
depth = np.load(fpath)['arr_0'].astype(np.float32)
return depth

def get_mono_normals(self, scene_id: str, camera_id: str, frame_index: int) -> np.ndarray:
assert self.image_mono_normals_dirname is not None, "You should specify image_mono_normals_dirname"
img_name = self.img_names[frame_index]
img_name = self.image_names[frame_index]
fpath = os.path.join(self.data_dir, self.image_mono_normals_dirname, f'{img_name}.jpg')
assert os.path.exists(fpath), f"Not exist: {fpath}"
# [-1.,1.] np.float32 in OpenCV local coords
Expand All @@ -167,4 +167,4 @@ def unit_test():
vis_camera_mplot(ax, dataset.intrs_all, dataset.c2ws_all, dataset.hws_all[0, 0], dataset.hws_all[0, 1],
cam_size=0.03, annotation=True, per_cam_axis=False)
plt.show()
unit_test()
unit_test()