v3d.Camera#

class visu3d.Camera(**kwargs)[source]#

Bases: visu3d.array_dataclass.DataclassArray

A camera located in space.

spec#

Camera intrinsics parameters

Type:

visu3d.dc_arrays.camera_spec.CameraSpec

world_from_cam#

Camera pose (v3d.Transformation)

Type:

visu3d.dc_arrays.transformation.Transform

spec: camera_spec.CameraSpec#
world_from_cam: transformation.Transform#
fig_config: camera_spec.TraceConfig = TraceConfig(     name=None,     num_samples=None,     scale=1.0, )#
classmethod from_look_at(*, pos: etils.enp.array_types.typing.FloatArray, target: etils.enp.array_types.typing.FloatArray, spec: visu3d.dc_arrays.camera_spec.CameraSpec) visu3d.dc_arrays.camera.Camera[source]#

Factory which creates a camera looking at target.

This assume the camera is parallel to the floor. See v3d.CameraSpec for axis conventions.

Parameters:
  • pos – Origin position

  • target – Target position

  • spec – Camera specifications.

Returns:

Camera pointing to the ray.

Return type:

cam

look_at(target: etils.enp.array_types.typing.FloatArray) visu3d.dc_arrays.camera.Camera[source]#

Returns a new camera looking at the target.

property resolution: tuple[int, int]#

(h, w) resolution in pixel.

property hw: tuple[int, int]#

(Height, Width) in pixel (for usage in (i, j) coordinates).

property wh: tuple[int, int]#

(Width, Height) in pixel (for usage in (u, v) coordinates).

property h: int#

Height in pixel.

property w: int#

Width in pixel.

rays(normalize: bool = True) visu3d.dc_arrays.ray.Ray[source]#

Creates the rays.

Parameters:

normalize – If False, returns camera rays in the z=1 from the camera frame.

Returns:

Pose

Return type:

rays

property cam_from_world: visu3d.dc_arrays.transformation.Transform#

Transformation from 3d world coordinates to 3d camera coordinates.

property px_from_world: visu3d.dc_arrays.transformation.TransformBase#

Transfomration from 3d world coordinates to 2d pixel coordinates.

property world_from_px: visu3d.dc_arrays.transformation.TransformBase#

Transfomration from 2d pixel coordinates to 3d world coordinates.

render(points: visu3d.dc_arrays.point.Point3d) etils.enp.array_types.typing.FloatArray[source]#

Project 3d points to the camera screen.

Parameters:

points – 3d points.

Returns:

The projected 3d points.

Return type:

img

replace_fig_config(*, name: str = Ellipsis, scale: float = Ellipsis, **kwargs: Any) dataclass_array.typing.DcT[source]#

Returns a copy of self with figure params overwritten.

apply_transform(tr: visu3d.dc_arrays.transformation.Transform) visu3d.dc_arrays.camera.Camera[source]#
make_traces() list[plotly.basedatatypes.BaseTraceType][source]#

Construct the traces of the given object.