cutcutcodec.core.signal.gauss

Gaussian tools.

Functions

gauss2d(sigma, dtype)

Compute a gaussian window.

gauss2d_fft(sigma, height, width, dtype)

Compute the fourier transform of a 2d gaussian window.

Details

cutcutcodec.core.signal.gauss.gauss2d(sigma: float, dtype: dtype) Tensor[source]

Compute a gaussian window.

Examples

>>> import torch
>>> from cutcutcodec.core.signal.gauss import gauss2d
>>> gauss2d(1.5, dtype=torch.float32).round(decimals=3)
tensor([[0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
         0.0000, 0.0000],
        [0.0000, 0.0000, 0.0000, 0.0010, 0.0020, 0.0020, 0.0020, 0.0010, 0.0000,
         0.0000, 0.0000],
        [0.0000, 0.0000, 0.0010, 0.0040, 0.0080, 0.0100, 0.0080, 0.0040, 0.0010,
         0.0000, 0.0000],
        [0.0000, 0.0010, 0.0040, 0.0120, 0.0230, 0.0290, 0.0230, 0.0120, 0.0040,
         0.0010, 0.0000],
        [0.0000, 0.0020, 0.0080, 0.0230, 0.0450, 0.0570, 0.0450, 0.0230, 0.0080,
         0.0020, 0.0000],
        [0.0000, 0.0020, 0.0100, 0.0290, 0.0570, 0.0710, 0.0570, 0.0290, 0.0100,
         0.0020, 0.0000],
        [0.0000, 0.0020, 0.0080, 0.0230, 0.0450, 0.0570, 0.0450, 0.0230, 0.0080,
         0.0020, 0.0000],
        [0.0000, 0.0010, 0.0040, 0.0120, 0.0230, 0.0290, 0.0230, 0.0120, 0.0040,
         0.0010, 0.0000],
        [0.0000, 0.0000, 0.0010, 0.0040, 0.0080, 0.0100, 0.0080, 0.0040, 0.0010,
         0.0000, 0.0000],
        [0.0000, 0.0000, 0.0000, 0.0010, 0.0020, 0.0020, 0.0020, 0.0010, 0.0000,
         0.0000, 0.0000],
        [0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
         0.0000, 0.0000]])
>>>
cutcutcodec.core.signal.gauss.gauss2d_fft(sigma: float, height: int, width: int, dtype: dtype) Tensor[source]

Compute the fourier transform of a 2d gaussian window.