Computes the 3d ray for a 2d point (the z component of the ray is 1).
tfg.rendering.camera.perspective.ray(
point_2d: type_alias.TensorLike,
focal: type_alias.TensorLike,
principal_point: type_alias.TensorLike,
name: str = 'perspective_ray'
) -> tf.Tensor
Computes the 3d ray (rx,ry,1) from the camera center to a 2d point (x′,y′) on the image plane with
rx=(x′−cx)fx,ry=(y′−cy)fy,z=1,
where (fx,fy) is the focal length and (cx,cy) the principal point. The camera optical center is assumed to be at (0,0,0).
Note | |
---|---|
In the following, A1 to An are optional batch dimensions that must be broadcast compatible. |
Returns | |
---|---|
A tensor of shape [A1, ..., An, 3] , where the last dimension represents
a 3d ray.
|