(motion,
length,
save_path,
params,
title="",
interval=50,
pred_cam=None,
imgs=None,
bbox=None,
side=None)
| 49 | |
| 50 | |
| 51 | def plot_3d_motion(motion, |
| 52 | length, |
| 53 | save_path, |
| 54 | params, |
| 55 | title="", |
| 56 | interval=50, |
| 57 | pred_cam=None, |
| 58 | imgs=None, |
| 59 | bbox=None, |
| 60 | side=None): |
| 61 | # render smpl |
| 62 | # [nframes, nVs, 3] |
| 63 | if motion.shape[1] == 6890: |
| 64 | # width = 250 |
| 65 | # height = 250 |
| 66 | width = 600 |
| 67 | height = 600 |
| 68 | if pred_cam is None: |
| 69 | # cam=(0.75, 0.75, 0, 0.1) |
| 70 | cam = (0.8, 0.8, 0, 0.1) |
| 71 | # cam=(0.9, 0.9, 0, 0.1) |
| 72 | else: |
| 73 | assert bbox is not None |
| 74 | assert imgs is not None |
| 75 | |
| 76 | # Tmp visulize |
| 77 | # weak perspective camera parameters in cropped image space (s,tx,ty) |
| 78 | # to |
| 79 | # weak perspective camera parameters in original image space (sx,sy,tx,ty) |
| 80 | cam = np.concatenate( |
| 81 | (pred_cam[:, [0]], pred_cam[:, [0]], pred_cam[:, 1:3]), axis=1) |
| 82 | |
| 83 | # ToDo convert to original cam |
| 84 | # load original img? |
| 85 | # calculate cam after padding??? |
| 86 | # |
| 87 | # cam = convert_crop_cam_to_orig_img( |
| 88 | # cam=pred_cam, |
| 89 | # bbox=bbox, |
| 90 | # img_width=width, |
| 91 | # img_height=height |
| 92 | # ) |
| 93 | cam_pose = np.eye(4) |
| 94 | cam_pose[0:3, 0:3] = R.from_euler('x', -90, degrees=True).as_matrix() |
| 95 | cam_pose[0:3, 3] = [0, 0, 0] |
| 96 | if side: |
| 97 | rz = np.eye(4) |
| 98 | rz[0:3, 0:3] = R.from_euler('z', -90, degrees=True).as_matrix() |
| 99 | cam_pose = np.matmul(rz, cam_pose) |
| 100 | |
| 101 | # # reshape input imgs |
| 102 | # if imgs is not None: |
| 103 | # imgs = convert_img(imgs.unsqueeze(0), height)[:,0] |
| 104 | backgrounds = imgs if imgs is not None else np.ones( |
| 105 | (height, width, 3)) * 255 |
| 106 | renderer = get_renderer(width, height, cam_pose) |
| 107 | |
| 108 | # [nframes, nVs, 3] |
no test coverage detected