# Background Subtraction for Dynamic Scenes Using Gabor Filter Bank and Statistical Moments
## 2 Theoretical Considerations
### Gabor Filter  
The Gabor filter bank is one of the functions that allow the density [60], thickness, or directionality of sudden and subtle intensity changes [61] to be characterized and is  
\begin{table}
\begin{tabular}{l c c c c} \hline \hline
**Statistics** & **640 \(\times\) 480** & **720 \(\times\) 576** & **360 \(\times\) 240** & **320 \(\times\) 240** \\ \hline Images evaluated per scene & 1200 & 1700 & 2050 & 1099 \\ Average (frames/second) & 4.70 & 3.65 & 3.95 & 3.95 \\ Standard deviation (frames/second) & 1.26 & 1.12 & 1.24 & 1.44 \\ Minimum (frames/second) & 2.73 & 1.95 & 2.14 & 2.37 \\
25\% frames/second) & 4.08 & 3.21 & 3.36 & 3.41 \\
50\% frames/second) & 4.40 & 3.37 & 3.56 & 3.61 \\
75\% (frames/second) & 4.70 & 3.57 & 3.93 & 3.79 \\ Maximum (frames/second) & 8.40 & 7.19 & 7.69 & 8.31 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Statistical description of computational efficiency.  
suitable for texture analysis. The 2-D Gabor function is composed of an envelope function and a carrier. The Gaussian function, commonly called the envelope, is shown in Equation (1):  
\[E_{\lambda,\sigma}=\eta\cdot\exp^{\left[\left(-\frac{\omega^{2}}{2\pi^{2}}-\frac{ \omega^{2}}{2\pi^{2}}\right)\right]} \tag{1}\]  
where \(\eta=\frac{1}{2\pi\lambda,\sigma_{x}\sigma_{y}}\). \(\sigma_{x}\) and \(\sigma_{y}\) represent the standard deviation of the Gaussian distribution on the \(x\)-axis and \(y\)-axis, and the parameter \(\lambda\) represents the filter wavelength. Then, \(u\) and \(v\) are the Cartesian coordinates of the spatial frequency given by Equation (2):  
\[\begin{split} u&=x\cos(\theta)+y\sin(\theta)\\ v&=y\sin(\theta)-x\cos(\theta)\end{split} \tag{2}\]  
while the carrier function is shown in Equation (3):  
\[C_{\lambda,\phi}=e^{i\omega} \tag{3}\]  
where \(\omega=2\pi\frac{\mu}{\lambda}+\phi\).  
The parameter \(\phi\) represents the phase shift of the complex exponent. The expression \(e^{i\omega}\) can be defined as two independent functions, one corresponding to the real part \((\cos\omega)\) and the other corresponding to the imaginary part \((\sin\omega)\). So, the Gabor nucleus is defined by Equation (4)  
\[G_{\lambda,\theta,\phi}=E_{\lambda,\sigma}\cdot C_{\lambda,\phi} \tag{4}\]  
This function is shown in Figure 1. According to the value of \(\lambda\), different frequencies can be obtained, and each frequency determines low-pass filter (large \(\lambda\)), high-pass filter (small \(\lambda\)) or band-pass filter.  
The parameters \(\sigma_{x}\) and \(\sigma_{y}\) make the Gaussian function increase or decrease in any of its axes, which means that if the Gaussian function extends more on the \(x\)-axis than on \(y\)-axis, and vice versa, the noise and edges will be attenuated in that axis. However, if the Gaussian term is small, the image's smoothness will be low, and the sine signal will obtain fewer sampling points.  
Figure 1: Gabor filter \(G_{\lambda,\theta,\phi}\).  
Finally, the Gabor transformation is shown in Equation (5), which is obtained from the convolution between the image and the Gabor nucleus:  
\[Y=I_{i}(x)*G_{\lambda,\beta,\phi}. \tag{5}\]  
Since this function has a real number term (\(Y_{r}\)) and a complex number term (\(Y_{c}\)), the amplitude \(M_{i}\) and the phase \(P_{i}\) can be obtained as shown in Equations (6) and (7):  
\[M_{i}=\sqrt{Y_{r}^{2}+Y_{c}^{2}} \tag{6}\]  
\[P_{i}=\tan^{-1}\left(\frac{Y_{c}}{Y_{r}}\right) \tag{7}\]  
The terms \(M_{i}\) and \(P_{i}\) are essential because they will define the structure and texture of the object, respectively.