Skip to content

Commit

Permalink
update coordinate convert
Browse files Browse the repository at this point in the history
  • Loading branch information
Jianxff committed May 2, 2024
1 parent fa3dfb0 commit 193db4e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion modules/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __len__(self) -> int:
return len(self.rgb_list)

def __getitem__(self, idx) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
raw_rgb = cv2.imread(str(self.rgb_list[idx]), cv2.IMREAD_UNCHANGED)
raw_rgb = cv2.imread(str(self.rgb_list[idx]), cv2.IMREAD_COLOR).astype(np.uint8)
raw_depth = None if not self.depth_list else np.load(self.depth_list[idx])
# pack data
rgb = self.preprocess(raw_rgb)
Expand Down
16 changes: 7 additions & 9 deletions modules/fusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,10 @@ def fusion(

def extract_mesh(
volume:o3d.pipelines.integration.ScalableTSDFVolume,
save: Optional[Union[str, Path]] = None,
viz: Optional[bool] = False
) -> o3d.geometry.TriangleMesh:
print('[TSDF] extracting mesh')
mesh = volume.extract_triangle_mesh()
# mesh.compute_vertex_normals()

if viz:
o3d.visualization.draw_geometries([mesh])
if save is not None:
o3d.io.write_triangle_mesh(str(save), mesh)

return mesh


Expand Down Expand Up @@ -189,7 +181,7 @@ def pipeline(
colored=colored
)

mesh = extract_mesh(volume, save=mesh_save, viz=viz)
mesh = extract_mesh(volume)

# convert to opengl
if cv_to_gl:
Expand All @@ -201,4 +193,10 @@ def pipeline(
])
mesh.transform(convert_cv_to_gl)

if mesh_save:
o3d.io.write_triangle_mesh(str(mesh_save), mesh)

if viz:
o3d.visualization.draw_geometries([mesh])

return mesh
2 changes: 1 addition & 1 deletion scripts/test_seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

parser.add_argument("--viz", action='store_true', help="visualize", default=False)
parser.add_argument("--overwrite", action='store_true', help="overwrite existing files", default=False)
parser.add_argument("--fusion", action='store_true', help="run rgbd fusion", default=True)
parser.add_argument("--fusion", action='store_true', help="run rgbd fusion", default=False)

parser.add_argument("--voxel-length", type=float, help="voxel length for fusion", default=0.05)
parser.add_argument("--global-ba-frontend", type=int, help="frequency to run global ba on frontend", default=0)
Expand Down
2 changes: 1 addition & 1 deletion scripts/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

parser.add_argument("--viz", action='store_true', help="visualize", default=False)
parser.add_argument("--overwrite", action='store_true', help="overwrite existing files", default=False)
parser.add_argument("--fusion", action='store_true', help="run rgbd fusion", default=True)
parser.add_argument("--fusion", action='store_true', help="run rgbd fusion", default=False)

parser.add_argument("--voxel-length", type=float, help="voxel length for fusion", default=0.05)
parser.add_argument("--global-ba-frontend", type=int, help="frequency to run global ba on frontend", default=0)
Expand Down

0 comments on commit 193db4e

Please sign in to comment.