Image.sameas#

Image.sameas(other, colororder: bool = True) bool[source][source]#

Compare two images for exact equality and return a scalar bool.

Parameters:
  • other (Image) – image to compare against

  • colororder (bool, optional) – compare colororder_str values if True, defaults to True

Returns:

exact image equality test

Return type:

bool

Unlike ==, which returns an element-wise boolean Image, this method returns True only if:

  • other is an Image

  • image shape is identical

  • image dtype is identical

  • color order is identical (if colororder is True)

  • all pixel values are identical

Example:

>>> from machinevisiontoolbox import Image
>>> a = Image([[1, 2], [3, 4]])
>>> b = Image([[1, 2], [3, 4]])
>>> a.sameas(b)
True
>>> True
True