import os import open3d as o3d import os.path as osp from rs_utils.io import get_options from rs_utils.realsense import RealSenseD435 def rotate_view(vis): """Rotates the view used in Open3D.""" ctr = vis.get_view_control() ctr.rotate(10.0, 0.0) return False if __name__ == '__main__': args = get_options() custom_rs_options = args.is_rsopt save_pcd_path = osp.join(osp.dirname(__file__), args.pcd_path) cfg_path = osp.join(osp.dirname(__file__), args.cfg_path) rs_d435 = RealSenseD435('RGBD', cfg_path, custom_rs_options) rs_d435.capture_pcd(save_pcd_path) print("saved " + save_pcd_path) # visualize saved pcd file pcd = o3d.io.read_point_cloud(save_pcd_path) o3d.visualization.draw_geometries_with_animation_callback([pcd], rotate_view)
#!/usr/bin/env python3 import os import os.path as osp from rs_utils.io import get_options from rs_utils.realsense import RealSenseD435 if __name__ == '__main__': args = get_options() save_type = args.save_type custom_rs_options = args.is_rsopt in_bag_path = osp.join(osp.dirname(__file__), args.bag_path) cfg_path = osp.join(osp.dirname(__file__), args.cfg_path) rs_d435 = RealSenseD435(save_type, cfg_path, custom_rs_options, in_bag_path) rs_d435.play_bag()
ctr = vis.get_view_control() ctr.rotate(10.0, 0.0) return False if __name__ == '__main__': args = get_options() custom_rs_options = args.is_rsopt save_pcd_paths = [ osp.join(osp.dirname(__file__), osp.splitext(args.pcd_path)[0] + '_' + str(i) + '.pcd') for i in range(args.num_camera) ] cfg_path = osp.join(osp.dirname(__file__), args.cfg_path) os.makedirs(os.path.dirname(args.pcd_path), exist_ok=True) rs_d435 = RealSenseD435('RGBD', cfg_path, custom_rs_options, device_sn=args.device_sn, num_camera=args.num_camera) rs_d435.capture_pcd(save_pcd_paths) for i, savepcdpath in enumerate(save_pcd_paths): print("displaying " + savepcdpath) # visualize saved pcd file pcd = o3d.io.read_point_cloud(save_pcd_paths[i]) o3d.visualization.draw_geometries_with_animation_callback([pcd], rotate_view)
import os import os.path as osp from rs_utils.io import get_options, get_file_paths from rs_utils.realsense import RealSenseD435 if __name__ == '__main__': args = get_options() save_type = args.save_type bags_dir = osp.join(osp.dirname(__file__), args.indir) cfg_path = osp.join(osp.dirname(__file__), args.cfg_path) save_dir = osp.join(osp.dirname(__file__), args.outdir) if not osp.exists(bags_dir): print("Not found directory for bag files...") exit() os.makedirs(save_dir, exist_ok=True) bag_paths, bag_names = get_file_paths(bags_dir, 'bag') for (bag_path, bag_name) in zip(bag_paths, bag_names): save_img_path_noext = osp.join(save_dir, bag_name) rs_d435 = RealSenseD435(save_type=save_type, rs_cfg_path=cfg_path, in_bag_path=bag_path) rs_d435.bag2img(save_img_path_noext, args.imgext, mode=args.save_mode, fps=args.save_fps, is_show=False)