drtk.transform#
Projects 3D vertex positions onto the image plane of the camera. |
|
Same as transform, but also returns the camera-space coordinates. |
- drtk.transform(v, campos=None, camrot=None, focal=None, princpt=None, K=None, Rt=None, distortion_mode=None, distortion_coeff=None, fov=None)[source]#
Projects 3D vertex positions onto the image plane of the camera.
- Parameters:
v (th.Tensor) – vertex positions. N x V x 3
campos (Tensor) – Camera position. N x 3
camrot (Tensor) – Camera rotation matrix. N x 3 x 3
focal (Tensor) – Focal length. The upper left 2x2 block of the intrinsic matrix [[f_x, s], [0, f_y]]. N x 2 x 2
princpt (Tensor) – Camera principal point [cx, cy]. N x 2
K (Tensor) – Camera intrinsic calibration matrix, N x 3 x 3
Rt (Tensor) – Camera extrinsic matrix. N x 3 x 4 or N x 4 x 4
distortion_mode (List[str]) – Names of the distortion modes.
distortion_coeff (Tensor) – Distortion coefficients. N x 4
fov (Tensor) – Valid field of view of the distortion model. N x 1
- Returns:
Vertex positions projected onto the image plane of the camera. The last dimension has still size 3. The first two components are the x and y coordinates on the image plane, and the z is z component of the vertex positions in the camera frame. The latter is used for depth values that are written to the z-buffer. N x V x 3
Warning
You must specify either
K
(intrinsic matrix) or bothfocal
andprincpt
(focal length and principal point).Additionally, you must provide either
Rt
(extrinsic matrix) or bothcampos
(camera position) andcamrot
(camera rotation).Note
If we split
Rt
of shape N x 3 x 4 intoR
of shape N x 3 x 3 andt
of shape N x 3 x 1, then:camrot
isR
, andcampos
is-R.T @ t
.