gaussian_gradient_magnitude#

pyrost.bin.gaussian_gradient_magnitude(inp: numpy.ndarray, sigma: Union[float, List[float]], mode: str = 'reflect', cval: float = 0.0, truncate: float = 4.0, backend: str = 'numpy', num_threads: int = 1)#

Multidimensional gradient magnitude using Gaussian derivatives. The multidimensional filter is implemented as a sequence of 1-D FFT convolutions.

Parameters
  • inp (numpy.ndarray) – The input array.

  • sigma (Union[float, List[float]]) – Standard deviation for Gaussian kernel. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes.

  • mode (str) –

    The mode parameter determines how the input array is extended when the filter overlaps a border. Default value is ‘reflect’. The valid values and their behavior is as follows:

    • constant, (k k k k | a b c d | k k k k) : The input is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.

    • nearest, (a a a a | a b c d | d d d d) : The input is extended by replicating the last pixel.

    • mirror, (c d c b | a b c d | c b a b) : The input is extended by reflecting about the center of the last pixel. This mode is also sometimes referred to as whole-sample symmetric.

    • reflect, (d c b a | a b c d | d c b a) : The input is extended by reflecting about the edge of the last pixel. This mode is also sometimes referred to as half-sample symmetric.

    • wrap, (a b c d | a b c d | a b c d) : The input is extended by wrapping around to the opposite edge.

  • cval (float) – Value to fill past edges of input if mode is constant. Default is 0.0.

  • truncate (float) – Truncate the filter at this many standard deviations. Default is 4.0.

  • backend (str) – Choose between numpy (‘numpy’) or FFTW (‘fftw’) backend library for the FFT implementation.

  • num_threads (int) – Number of threads.

Raises
Returns

Gaussian gradient magnitude array. The array is the same shape as inp.

Return type

numpy.ndarray