Image.print#
- Image.print(fmt: str | None = None, separator: str = ' ', precision: int = 2, header: bool = False, file=None) None[source][source]#
Print image pixels in compact format
- Parameters:
fmt (str, optional) – format string, defaults to None
separator (str, optional) – value separator, defaults to single space
precision (int, optional) – precision for floating point pixel values, defaults to 2
header (bool, optional) – print image summary header, defaults to True
file (file, optional) – file to print to, defaults to None
- Returns:
the printed image
- Return type:
Very compact display of pixel numerical values in grid layout.
Example:
>>> from machinevisiontoolbox import Image >>> img = Image.Squares(1, size=10) >>> img.print() 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 >>> img = Image.Squares(1, size=10, dtype='float') >>> img.print(precision=1, header=True) Image: 10 x 10 (float32), 1 anonymous plane span=[0, 1]; mean=0.36, 𝜎=0.48; median=0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Note
For a boolean image True and False are displayed as 1 and 0 respectively.
For a multiplane images the planes are printed sequentially, along with the plane’s name.
- Seealso: