Background#

class deeptrack.optical.noises.Background(offset: float | Callable[[...], float], **kwargs: Any)#

Bases: Noise

Add a constant value to an image.

Parameters#

offset: PropertyLike[float]

Constant value added to the image.

**kwargs: Any

Additional keyword arguments passed to the parent Noise class.

Methods#

get(image, offset, **kwargs) -> np.ndarray | torch.Tensor

Adds the constant offset to the input image.

Examples#

>>> import deeptrack as dt
>>> import numpy as np

Create an input image with zeros

>>> image = np.zeros((2, 2))

Define a background offset:

>>> noise = dt.Background(offset=0.5)

Apply the noise

>>> noisy = noise(image)
>>> print(noisy)
[[0.5 0.5]
 [0.5 0.5]]

Methods Summary

get(image, offset, **kwargs)

Add the given offset to the image.

Methods Documentation

get(image: ndarray | Tensor, offset: float, **kwargs: Any) ndarray | Tensor#

Add the given offset to the image.

Parameters#

image: np.ndarray | torch.Tensor

The input image.

offset: float

The value to add to the image.

Returns#

np.ndarray | torch.Tensor

The image with offset added.