pysdic.ImagePlotter.add_image#

ImagePlotter.add_image(image=None, *, channel=None, bgr=True, cmap='gray', clim=None, opacity=1.0, show_bar=False, bar=None)[source]#

Draw an image on the sensor, with its pixels centered at integer coordinates.

  • A grayscale image \((H, W)\) or \((H, W, 1)\) (or one channel of an image, selected with channel) is drawn with the colormap cmap and the color limits clim.

  • A color image \((H, W, 3)\) or \((H, W, 4)\) is drawn in RGB(A). Its values are rescaled from clim to \([0, 1]\), except for numpy.uint8 images displayed as they are when clim is None.

Parameters:
  • image (Optional[Union[pysdic.Image, ArrayLike]], optional) – The image to draw, of height and width equal to the sensor size: an pysdic.Image or an array (e.g. a map of residuals). If None, the image of the view given to the plotter is used.

  • channel (Optional[Integral], optional) – The index of a channel to draw as a grayscale image. By default, all the channels are drawn.

  • bgr (bool, optional (default: True)) – Whether the channels of a color image are in BGR(A) order (as read by pysdic.Image.from_file() with OpenCV). They are then converted to RGB(A).

  • cmap (Optional[Union[str, matplotlib.colors.Colormap]], optional (default: "gray")) – The colormap of a grayscale image.

  • clim (Optional[Tuple[Real, Real]], optional) – The color limits (min, max). By default, the minimum and the maximum of the finite values of the image (except for numpy.uint8 color images).

  • opacity (Real, optional (default: 1.0)) – The opacity of the image, between 0.0 and 1.0.

  • show_bar (bool, optional (default: False)) – Whether to show the color bar of a grayscale image.

  • bar (Optional[Dict[str, Any]], optional) – The keyword arguments of matplotlib.figure.Figure.colorbar when show_bar is True.

Raises:
  • TypeError – If image has a wrong type.

  • ValueError – If no image is given without view, if the image does not match the sensor size, has a wrong number of channels, or if clim is invalid.

  • IndexError – If channel is out of range.

Return type:

None