WienerFilter

class eyefeatures.preprocessing.smoothing.WienerFilter(x, y, t=None, pk=None, K=4.3e-05, sigma=0.2, size=11)[source]

Bases: BaseSmoothingPreprocessor

Wiener filter. Applied independently along ‘x’ and ‘y’ axis.

Parameters:
  • K (float | Literal['auto']) – estimate of ratio of noise-to-signal spectra. If ‘auto’, such value of K on grid [-1e-3, 1e-3] with 2e3 values is chosen to minimize PSNR.

  • sigma (float) – std of Gaussian filter.

  • size (int) – length of Gaussian filter.

  • x (str)

  • y (str)

  • t (str)

  • pk (list[str])

Algorithm

This filter assumes the following model of distortion:

\[g(x) = f(x) * h(x) + s(x)\]

where \(f\) is true signal, \(h\) is distortion signal, \(*\) is convolution operation, \(s\) is noise, and \(g\) is distorted signal (observed signal). Wiener’s approach considers input signal and noise as random variables and finds estimator \(\hat{f}\) which minimizes the variance of \(\hat{f} - f\). It could be shown that in the underlined model the minimum is achieved (in Fourier frequency domain) at:

\[\hat{F}(x) = \frac{\overline{H(x)}}{|H(x)|^2 + K}G(x)\]

where

  • \(\hat{F}(x)\) - Fourier-image of \(f\).

  • \(H(x)\) - Fourier-image of distorting function \(h\).

  • \(\overline{\cdot}\) - complex inverse.

  • \(|\cdot|\) - complex modulus.

  • \(K\) - approximation constant.