| 194 | |
| 195 | # transform SMPL such that the target camera extrinsic will be met |
| 196 | def transform_smpl(curr_extrinsic, target_extrinsic, smpl_pose, smpl_trans, T_hip): |
| 197 | |
| 198 | R_root = cv2.Rodrigues(smpl_pose[:3])[0] |
| 199 | transf_global_ori = np.linalg.inv(target_extrinsic[:3,:3]) @ curr_extrinsic[:3,:3] @ R_root |
| 200 | |
| 201 | target_extrinsic[:3, -1] = curr_extrinsic[:3,:3] @ (smpl_trans + T_hip) + curr_extrinsic[:3, -1] - smpl_trans - target_extrinsic[:3,:3] @ T_hip |
| 202 | |
| 203 | smpl_pose[:3] = cv2.Rodrigues(transf_global_ori)[0].reshape(3) |
| 204 | smpl_trans = np.linalg.inv(target_extrinsic[:3,:3]) @ smpl_trans # we assume |
| 205 | |
| 206 | return target_extrinsic, smpl_pose, smpl_trans |
| 207 | |
| 208 | class GMoF(nn.Module): |
| 209 | def __init__(self, rho=1): |