Function
getWorld2View2
(R, t, translate=np.array([.0, .0, .0]), scale=1.0)
Source from the content-addressed store, hash-verified
| 50 | return np.float32(Rt) |
| 51 | |
| 52 | def getWorld2View2(R, t, translate=np.array([.0, .0, .0]), scale=1.0): |
| 53 | Rt = np.zeros((4, 4)) |
| 54 | Rt[:3, :3] = R.transpose() |
| 55 | Rt[:3, 3] = t |
| 56 | Rt[3, 3] = 1.0 |
| 57 | |
| 58 | C2W = np.linalg.inv(Rt) |
| 59 | cam_center = C2W[:3, 3] |
| 60 | cam_center = (cam_center + translate) * scale |
| 61 | C2W[:3, 3] = cam_center |
| 62 | Rt = np.linalg.inv(C2W) |
| 63 | return np.float32(Rt) |
| 64 | |
| 65 | def getProjectionMatrix(znear, zfar, fovX, fovY): |
| 66 | tanHalfFovY = math.tan((fovY / 2)) |
Tested by
no test coverage detected