machinevisiontoolbox.Image.max

Image.max(*args, **kwargs)[source]

Maximum value of all pixels

Parameters:
  • args – additional positional arguments to numpy.max

  • kwargs – additional keyword arguments to numpy.max

Returns:

maximum value

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image.Read('flowers1.png')
>>> img.max()
255
>>> img = Image.Read('flowers1.png', dtype='float32')
>>> img.max(axis=2)
array([[0.4353, 0.4039, 0.4157, ..., 0.9294, 0.9686, 1.    ],
       [0.4275, 0.4118, 0.4157, ..., 0.949 , 0.9765, 1.    ],
       [0.4157, 0.4157, 0.4118, ..., 0.9176, 0.9961, 1.    ],
       ...,
       [0.502 , 0.4314, 0.4235, ..., 0.502 , 0.5176, 0.5451],
       [0.4706, 0.4078, 0.3725, ..., 0.4902, 0.5059, 0.5255],
       [0.4392, 0.3804, 0.3333, ..., 0.4706, 0.4941, 0.5098]],
      dtype=float32)
Note:
  • The return value type is the same as the image type.

  • By default the result is a scalar computed over all pixels, if the axis option is given the results is a 1D or 2D NumPy array.

Seealso:

numpy.max