IO¶
image_io.py¶
27 28 29 30 31 32 33 34 35 | import open3d as o3d if __name__ == "__main__": img_data = o3d.data.JuneauImage() print(f"Reading image from file: Juneau.jpg stored at {img_data.path}") img = o3d.io.read_image(img_data.path) print(img) print("Saving image to file: copy_of_Juneau.jpg") o3d.io.write_image("copy_of_Juneau.jpg", img) |
point_cloud_io.py¶
27 28 29 30 31 32 33 34 35 36 | import open3d as o3d if __name__ == "__main__": pcd_data = o3d.data.PCDPointCloud() print( f"Reading pointcloud from file: fragment.pcd stored at {pcd_data.path}") pcd = o3d.io.read_point_cloud(pcd_data.path) print(pcd) print("Saving pointcloud to file: copy_of_fragment.pcd") o3d.io.write_point_cloud("copy_of_fragment.pcd", pcd) |
realsense_io.py¶
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | import open3d as o3d if __name__ == "__main__": o3d.t.io.RealSenseSensor.list_devices() rscam = o3d.t.io.RealSenseSensor() rscam.start_capture() print(rscam.get_metadata()) for fid in range(5): rgbd_frame = rscam.capture_frame() o3d.io.write_image(f"color{fid:05d}.jpg", rgbd_frame.color.to_legacy()) o3d.io.write_image(f"depth{fid:05d}.png", rgbd_frame.depth.to_legacy()) print("Frame: {}, time: {}s".format(fid, rscam.get_timestamp() * 1e-6)) rscam.stop_capture() |
triangle_mesh_io.py¶
27 28 29 30 31 32 33 34 35 | import open3d as o3d if __name__ == "__main__": knot_data = o3d.data.KnotMesh() print(f"Reading mesh from file: knot.ply stored at {knot_data.path}") mesh = o3d.io.read_triangle_mesh(knot_data.path) print(mesh) print("Saving mesh to file: copy_of_knot.ply") o3d.io.write_triangle_mesh("copy_of_knot.ply", mesh) |