(rotvec)
| 79 | # Computes rotation matrix through Rodrigues formula as in cv2.Rodrigues |
| 80 | # Source: smpl/plugins/blender/corrective_bpy_sh.py |
| 81 | def Rodrigues(rotvec): |
| 82 | theta = np.linalg.norm(rotvec) |
| 83 | r = (rotvec/theta).reshape(3, 1) if theta > 0. else rotvec |
| 84 | cost = np.cos(theta) |
| 85 | mat = np.asarray([[0, -r[2], r[1]], |
| 86 | [r[2], 0, -r[0]], |
| 87 | [-r[1], r[0], 0]]) |
| 88 | return(cost*np.eye(3) + (1-cost)*r.dot(r.T) + np.sin(theta)*mat) |
| 89 | |
| 90 | |
| 91 | # Setup scene |