(input_dir, output_file, voxel_size=0.0, truncation_mult=4.0)
| 103 | |
| 104 | |
| 105 | def dmap2tsdf(input_dir, output_file, voxel_size=0.0, truncation_mult=4.0): |
| 106 | dmap_paths = sorted(glob(os.path.join(input_dir, "*.dmap"))) |
| 107 | |
| 108 | # Estimate GSD if voxel size is not provided |
| 109 | if voxel_size == 0.0: |
| 110 | voxel_size = estimate_gsd_from_depth_maps(dmap_paths) * 3.0 |
| 111 | print(f"Estimated voxel size: {voxel_size}") |
| 112 | |
| 113 | # Reconstruct mesh |
| 114 | mesh = create_mesh_from_depth_maps(dmap_paths, voxel_size, truncation_mult) |
| 115 | print(f"Reconstructed mesh with {len(mesh.vertices)} vertices and {len(mesh.triangles)} triangles") |
| 116 | |
| 117 | # Save the mesh |
| 118 | o3d.io.write_triangle_mesh(output_file, mesh) |
| 119 | print(f"Mesh saved to {output_file}") |
| 120 | |
| 121 | |
| 122 | if __name__ == "__main__": |
no test coverage detected