diff --git a/TODO.md b/TODO.md index 10e7900..487f8f4 100644 --- a/TODO.md +++ b/TODO.md @@ -2,14 +2,13 @@ - [ ] Camera 2d projection (PyTorch pinhole camera) - [ ] 3D transformation rewrite using PyTorch or SciPy -- [ ] PyRenderer camera initial location + position (?) +- [x] PyRenderer camera initial location + position (?) - [ ] Setup Pose PyTorch module (W) - [ ] pose cost function ## Nice to have -- [ ] - [ ] add original input image to scene - [ ] Render a camera to the scene for projection visualization - [ ] Vposer or other technique for mesh intersection priors diff --git a/renderer.py b/renderer.py index d96c09a..85ecd72 100644 --- a/renderer.py +++ b/renderer.py @@ -1,6 +1,7 @@ import numpy as np from utils import render_model, render_points import pyrender +from scipy.spatial.transform import Rotation as R class Renderer: @@ -17,10 +18,12 @@ class Renderer: if camera is None: camera = pyrender.OrthographicCamera(ymag=1, xmag=1) + + if camera_pose is None: camera_pose = np.eye(4) - camera_pose[:3, 3] = np.array([0, 0, -2]) - camera_pose[0, 0] *= -1.0 + camera_pose[:3, :3] = R.from_rotvec(np.pi/2 * np.array([0, 0, 0])).as_matrix() + camera_pose[:3, 3] = np.array([0, 0, 4]) self.groups = { "body": [],