prtools.gauss_kernel#
- gauss_kernel(shape, sigma, oversample=1, fftshift=True)[source]#
2D Gaussian filter kernel
This function returns the transfer function of a normalized 2D Gaussian function.
- Parameters:
shape (int or tuple of int) – Shape of the kernel
sigma (float) – Standard deviation of Gaussian. Providing two values allows for non-symmetric Gaussian interpreted as (sigma_row, sigma_col)
oversample (float, optional) – Oversampling factor to represent in the kernel. Default is 1.
fftshift (bool, optional) – If True (default), the kernel is FFT-shifted before it is returned.
- Return type:
ndarray
See also
Examples
>>> blur_kernel = prtools.gauss_kernel((256,256), 1) >>> plt.imshow(blur_kernel, cmap='gray')
Note this is functionally equivalent to
>>> r = np.fft.fftfreq(256) >>> c = np.fft.fftfreq(256) >>> sigma = 1 >>> blur_kernel = np.fft.fftshift(prtools.gauss(r, c, 1/(2*np.pi*sigma))) >>> plt.imshow(blur_kernel, cmap='gray')