spkit.denorm_kernel

spkit.denorm_kernel(kernel, mode=None, keep_scale=False, esp=1e-05)

De-normalise 1d/2d Kernel

De-normalise 1d or 2d Kernel

Often we use normalised kernels for processing (e.g. convolution, filtering), However, in some cases, we like to have un-normalised kernel, such as conv1d_nan and conv2d_nan.

De-normalising kernel will scale the weights of the kernel, keeping the relative differences.

Parameters:
kernel: 1d-array, 2d-array
  • kernel, example : kernel = [1/3, 1/3, 1/3]

Returns:
nkernel: same size as input
  • denprmised kernel, nkernel = [1, 1, 1]

Notes

#TODO

Examples

>>> #sp.denorm_kernel
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> import spkit as sp
>>> kernel = np.ones([3,3])/9
>>> kernel
>>> print(kernel)
array([[0.11111111, 0.11111111, 0.11111111],
      [0.11111111, 0.11111111, 0.11111111],
      [0.11111111, 0.11111111, 0.11111111]])
>>> denorm_kernel(kernel)
array([[1., 1., 1.],
       [1., 1., 1.],
       [1., 1., 1.]])