Skip to content

Commit

Permalink
fix camera pose writing in gen_hm3dsem_from_poses
Browse files Browse the repository at this point in the history
  • Loading branch information
abwerby committed Jul 22, 2024
1 parent 03423d3 commit 6e75600
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
*.pth
*.pyc
*.pyo
/hovsg.egg-info
/hovsg.egg-info
/data/hm3dsem_walks
/data/scene_graphs
/outputs
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ The Data folder should have the following structure:
### Create Scene Graphs (only for Habitat Matterport 3D Semantics):
```bash
python application/create_graph.py main.dataset=hm3dsem main.dataset_path=hm3dsem_walks/val/00824-Dd4bFSTQ8gi/ main.save_path=data/scene_graphs/00824-Dd4bFSTQ8gi
python application/create_graph.py main.dataset=hm3dsem main.dataset_path=data/hm3dsem_walks/val/00824-Dd4bFSTQ8gi/ main.save_path=data/scene_graphs/00824-Dd4bFSTQ8gi
```
<details>
<summary>This will generate a scene graph for the specified RGB-D sequence and save it. The following files are generated:</summary>
Expand Down
10 changes: 8 additions & 2 deletions data/habitat/habitat_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,14 @@ def save_obs(
save_dir = os.path.join(root_save_dir, "pose")
os.makedirs(save_dir, exist_ok=True)
save_path = os.path.join(save_dir, save_name)
with open(save_path, "wb") as f:
np.savetxt(f, pose)
# convert quaternion to rotation matrix
rot = R.from_quat(pose[3:])
pose_mat = np.eye(4)
pose_mat[:3, :3] = rot.as_matrix()
pose_mat[:3, 3] = pose[:3]
with open(save_path, "w") as f:
f.write("\t".join([str(x) for x in pose_mat.flatten()]))
f.write("\n")



Expand Down

0 comments on commit 6e75600

Please sign in to comment.