machinevisiontoolbox.Image.print

Image.print(fmt=None, seperator=' ', precision=2)[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

Very compact display of pixel numerical values in grid layout.

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image.Squares(1, 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 0 0 0
 0 0 1 1 1 1 1 0 0 0
 0 0 1 1 1 1 1 0 0 0
 0 0 1 1 1 1 1 0 0 0
 0 0 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 0
 0 0 0 0 0 0 0 0 0 0
>>> img = Image.Squares(1, 10, dtype='float')
>>> img.print()
 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
 0.00 0.00 1.00 1.00 1.00 1.00 1.00 0.00 0.00 0.00
 0.00 0.00 1.00 1.00 1.00 1.00 1.00 0.00 0.00 0.00
 0.00 0.00 1.00 1.00 1.00 1.00 1.00 0.00 0.00 0.00
 0.00 0.00 1.00 1.00 1.00 1.00 1.00 0.00 0.00 0.00
 0.00 0.00 1.00 1.00 1.00 1.00 1.00 0.00 0.00 0.00
 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Note:
  • For a boolean image True and False are displayed as 1 and 0 respectively.

  • For a multiplane images the planes are printed sequentially.

Seealso:

showpixels