Spaces:
Paused
Paused
Upload pytorch3d_stub/pytorch3d/renderer/camera_utils.py with huggingface_hub
Browse files
pytorch3d_stub/pytorch3d/renderer/camera_utils.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""pytorch3d.renderer.camera_utils stub."""
|
| 2 |
+
import torch
|
| 3 |
+
|
| 4 |
+
def camera_to_eye_at_up(camera):
|
| 5 |
+
"""Extract eye, at, up from camera. Minimal stub."""
|
| 6 |
+
R = camera.R if hasattr(camera, "R") else torch.eye(3).unsqueeze(0)
|
| 7 |
+
T = camera.T if hasattr(camera, "T") else torch.zeros(1, 3)
|
| 8 |
+
eye = -torch.bmm(R, T.unsqueeze(-1)).squeeze(-1)
|
| 9 |
+
at = torch.zeros_like(eye)
|
| 10 |
+
up = torch.tensor([[0.0, 1.0, 0.0]])
|
| 11 |
+
return eye, at, up
|