calculator.subtract

Functions

subtract(image1, image2)

Subtract image2 from image2 element-wise.

Module Contents

calculator.subtract.subtract(image1, image2)

Subtract image2 from image2 element-wise.

Parameters:
  • image1 (Image) – The image to be subtracted from.

  • image2 (Image) – The image to subtract.

Returns:

A new Image object holding the subtraction of the provided images.

Return type:

Image

Examples

>>> from calculator import add, Image
>>> image1 = Image.from_array([[1, 2], [3, 4]])
>>> image2 = Image.from_array([[1, 1], [1, 1]])
>>> image3 = subtract(image1, image2)
>>> image3.data
array([[0, 1],
       [2, 3]])