View source on GitHub |
Unprojects a 2d point in 3d.
tfg.rendering.camera.perspective.unproject(
point_2d: type_alias.TensorLike,
depth: type_alias.TensorLike,
focal: type_alias.TensorLike,
principal_point: type_alias.TensorLike,
name: str = 'perspective_unproject'
) -> tf.Tensor
Unprojects a 2d point \((x', y')\) to a 3d point \((x, y, z)\) knowing the depth \(z\) with
\[ \begin{matrix} x = \frac{z (x' - c_x)}{f_x}, & y = \frac{z(y' - c_y)}{f_y}, & z = z, \end{matrix} \]
where \((f_x, f_y)\) is the focal length and \((c_x, c_y)\) the principal point.
Note | |
---|---|
In the following, A1 to An are optional batch dimensions. |
Returns | |
---|---|
A tensor of shape [A1, ..., An, 3] , where the last dimension represents
a 3d point.
|
Raises | |
---|---|
ValueError
|
If the shape of point_2d , depth , focal , or
principal_point is not supported.
|