From 926a0b9dcc0eff5d37c393bf83ffa45cb2653126 Mon Sep 17 00:00:00 2001 From: Alex Yu Date: Tue, 14 Dec 2021 16:19:06 -0800 Subject: [PATCH] Remove faulty 'seg' logic in view_data.py #9 --- opt/scripts/view_data.py | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/opt/scripts/view_data.py b/opt/scripts/view_data.py index c78b3d14..366e7b85 100644 --- a/opt/scripts/view_data.py +++ b/opt/scripts/view_data.py @@ -230,18 +230,15 @@ def look_for_dir(cands, required=True): all_poses = [] pnum, seg_begin = None, 0 - segs = [] for i, pose_file in enumerate(pose_files): pose = np.loadtxt(path.join(pose_dir, pose_file)).reshape(4, 4) splt = path.splitext(pose_file)[0].split('_') num = int(splt[1] if len(splt) > 1 else splt[0]) if pnum is not None and num - pnum > 1 and seg_begin < num: - segs.append((seg_begin, num)) - seg_begin = num + seg_begin = i pnum = num all_poses.append(pose) all_poses = np.stack(all_poses) - segs.append((seg_begin, len(pose_files))) def get_transform(c2w): t = c2w[:, :3, 3] @@ -323,18 +320,14 @@ def get_transform(c2w): center = origin - vforward * np.linalg.norm(t - origin, axis=-1).mean() * 0.7 * 3 print(' camera center', center, 'vforward', vforward, 'world_up', world_up) - for i, seg in enumerate(segs): - print(seg) - print(R.shape, t.shape) - print(seg[0], seg[1]) - scene.add_camera_frustum(name=f"traj_{i:04d}", focal_length=focal, - image_width=image_wh[0], - image_height=image_wh[1], - z=0.1, - r=R[seg[0]:seg[1]], - t=t[seg[0]:seg[1]], - connect=args.seg, - color=[1.0, 0.0, 0.0]) + scene.add_camera_frustum(name=f"traj_{i:04d}", focal_length=focal, + image_width=image_wh[0], + image_height=image_wh[1], + z=0.1, + r=R, + t=t, + connect=args.seg, + color=[1.0, 0.0, 0.0]) if pose_gt_dir is not None: print('Loading GT')