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 colormapcmapand the color limitsclim.A color image \((H, W, 3)\) or \((H, W, 4)\) is drawn in RGB(A). Its values are rescaled from
climto \([0, 1]\), except fornumpy.uint8images displayed as they are whenclimis None.
- Parameters:
image (Optional[Union[
pysdic.Image, ArrayLike]], optional) – The image to draw, of height and width equal to the sensor size: anpysdic.Imageor 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 bypysdic.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.uint8color images).opacity (Real, optional (default:
1.0)) – The opacity of the image, between0.0and1.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.colorbarwhenshow_baris True.
- Raises:
TypeError – If
imagehas 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
climis invalid.IndexError – If
channelis out of range.
- Return type:
None