Projection functions#
Project 3D world-space vertices to pixel-space, optionally applying a distortion model with provided coefficients. |
|
Computes the gradient of projected (pixel-space) vertex positions with respect to the 3D world-space vertex positions given the gradient of the 3D world-space vertex positions. |
- drtk.utils.projection.project_points(v, campos, camrot, focal, princpt, distortion_mode=None, distortion_coeff=None, fov=None)[source]#
Project 3D world-space vertices to pixel-space, optionally applying a distortion model with provided coefficients.
Returns v_pix, v_cam, both N x V x 3 since we preserve the camera-space Z-coordinate for v_pix.
v: N x V x 3 camrot: N x 3 x 3 campos: N x 3 focal: N x 2 x 2 princpt: N x 2 distortion_coeff: N x 4 fov: N x 1
- drtk.utils.projection.project_points_grad(v_grad, v, campos, camrot, focal, distortion_mode=None, distortion_coeff=None)[source]#
Computes the gradient of projected (pixel-space) vertex positions with respect to the 3D world-space vertex positions given the gradient of the 3D world-space vertex positions.
project_points_grad(dv, v) = d project_points(v) / dv * dv
- Parameters:
v_grad – Gradient of 3D world-space vertices. Shape: N x V x 3
v – 3D world-space vertices. Shape: N x V x 3
camrot – Camera rotation. Shape: N x 3 x 3
camrot – Camera position. Shape: N x 3
focal – Focal length. Shape: N x 2 x 2
distortion_mode – Distortion currently not implemented and must be None.
distortion_coeff – Distortion currently not implemented and must be None.
- Returns:
N x V x 2
- Return type:
Gradient of 2D pixel-space vertices