pytransform3d.plot_utils.Camera#
- class pytransform3d.plot_utils.Camera(M, cam2world, virtual_image_distance=1.0, sensor_size=(1920, 1080), **kwargs)[source]#
Bases:
Artist
A Matplotlib artist that displays a camera.
This function is inspired by Blender’s camera visualization. It will show the camera center, a virtual image plane, and the top of the virtual image plane.
- Parameters:
- Marray-like, shape (3, 3)
Intrinsic camera matrix that contains the focal lengths on the diagonal and the center of the the image in the last column. It does not matter whether values are given in meters or pixels as long as the unit is the same as for the sensor size.
- cam2worldarray-like, shape (4, 4)
Transformation matrix of camera in world frame. We assume that the position is given in meters.
- virtual_image_distancefloat, optional (default: 1)
Distance from pinhole to virtual image plane that will be displayed. We assume that this distance is given in meters.
- sensor_sizearray-like, shape (2,), optional (default: [1920, 1080])
Size of the image sensor: (width, height). It does not matter whether values are given in meters or pixels as long as the unit is the same as for the sensor size.
- kwargsdict, optional (default: {})
Additional arguments for the plotting functions, e.g. alpha.
Methods
__init__
(M, cam2world[, ...])add_camera
(axis)Add the camera to a 3D axis.
draw
(renderer, *args, **kwargs)Draw the artist.
set
(*[, agg_filter, alpha, animated, ...])Set multiple properties at once.
set_data
(cam2world)Set the transformation data.
Attributes
- set_data(cam2world)[source]#
Set the transformation data.
- Parameters:
- cam2worldarray-like, shape (4, 4)
Transform from frame A to frame B
- set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, data=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, mouseover=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)#
Set multiple properties at once.
Supported properties are
- Properties:
agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: scalar or None animated: bool clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None data: array-like, shape (4, 4) figure: ~matplotlib.figure.Figure gid: str in_layout: bool label: object mouseover: bool path_effects: list of .AbstractPathEffect picker: None or bool or float or callable rasterized: bool sketch_params: (scale: float, length: float, randomness: float) snap: bool or None transform: ~matplotlib.transforms.Transform url: str visible: bool zorder: float