calculator

Submodules

Attributes

PI

Classes

Image

Functions

add(image1, image2)

Add the two provided images element-wise.

Package Contents

class calculator.Image(data)
Parameters:

data (numpy.ndarray)

_data: numpy.ndarray
property data: numpy.ndarray
Return type:

numpy.ndarray

classmethod from_array(data)
Parameters:

data (list)

classmethod from_file(file_path)
Parameters:

file_path (str | pathlib.Path)

calculator.add(image1, image2)

Add the two provided images element-wise.

Parameters:
  • image1 (Image) – The first image to be added.

  • image2 (Image) – The second image to be aded.

Returns:

A new Image object holding the sum 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 = add(image1, image2)
>>> image3.data
array([[2, 3],
       [4, 5]])
calculator.PI = 3.1415