pysdic.Camera.quick_visualize#

Camera.quick_visualize(geometry=None, *, image=None, figsize=(8, 6), title=None, show_vertices_index=False, show_elements_index=False, index_font_size=8)[source]#

Quickly visualize the sensor of the camera (or an image) and the projection of a point cloud or a mesh with pysdic.ImagePlotter.

See also

For more control over the visualization, use pysdic.ImagePlotter.

Parameters:
  • geometry (Optional[Union[ArrayLike, pysdic.PointCloud, pysdic.Mesh]], optional) – The world points \((N_p, E)\), point cloud or mesh to project and draw (see pysdic.ImagePlotter.add_point_cloud() and pysdic.ImagePlotter.add_mesh()). If None, nothing is drawn on the sensor.

  • image (Optional[Union[ArrayLike, pysdic.Image]], optional) – A background image matching the sensor size (see pysdic.ImagePlotter.add_image()). If None, the sensor is drawn.

  • figsize (Tuple[Real, Real], optional (default: (8, 6))) – The size of the figure in inches (width, height).

  • title (Optional[str], optional) – The title of the plot.

  • show_vertices_index (bool, optional (default: False)) – Whether to write the index of each displayed point (or vertex of the mesh) next to it.

  • show_elements_index (bool, optional (default: False)) – Whether to write the index of each displayed element of the mesh at its projected center (only for a mesh).

  • index_font_size (Real, optional (default: 8)) – The font size of the indices in typographic points (constant when zooming).

Raises:

ValueError – If show_elements_index is True and geometry is not a mesh.

Return type:

None

Examples

Visualize the projection of some points with a simple camera:

import numpy
from pysdic import Camera, PerspectiveExtrinsic, PinholeIntrinsic

extrinsic = PerspectiveExtrinsic.from_rt(rvec=[0.1, 0.2, 0.3], tvec=[12.0, 34.0, 56.0])
intrinsic = PinholeIntrinsic.from_matrix([[1000.0, 0.0, 320.0],
                                          [0.0, 1000.0, 240.0],
                                          [0.0, 0.0, 1.0]])
camera = Camera(480, 640, intrinsic=intrinsic, extrinsic=extrinsic)

world_points = numpy.array([[0, 0, 1000], [100, 0, 1000], [0, 100, 1000], [100, 100, 1000]])
camera.quick_visualize(world_points, title="Projected Points", show_vertices_index=True)