xoa.filter.generate_isotropic_kernel

xoa.filter.generate_isotropic_kernel(shape, window_func, fill_value=0, npt=None)[source]

Generate an nD istropic kernel given a shape and a window function

Parameters:
  • shape (int, tuple) – Shape of the desired kernel

  • window_func (str, callable) – Function that take a size parameter as unique argument. If a string, it is expected to be a numpy window function.

  • fill_value (float) – Value to set when outside window bounds, near the corners

  • npt (int, None) – Number of interpolation point to get the window value at all positions. It is infered from shape if not given.

Returns:

np.ndarray – Isotropic kernel array

Example

In [1]: kernel = generate_isotropic_kernel((20, 30), "bartlett", np.nan)

In [2]: plt.matshow(kernel, cmap="cmo.solar");

In [3]: plt.colorbar();
../_images/api.filter.generate_isotropic_kernel.png