# Methods for Improving Image Quality for Contour and Textures Analysis Using New Wavelet Methods
## 2 Materials and Methods  
### Improving Image Quality by Wiener Empirical Filtering in the Wavelet Domain  
Consider a sequence of input data \(y\ =\ x+n\), consisting of the sum of the samples of the useful signal \(x\ =\ \left\{x_{i}\right\}_{i\ =\ 1}^{N}\) and the additive white Gaussian noise \(n\ =\ \left\{n_{i}\right\}_{i\ =\ 1}^{N}\), both the useful signal \(x\) and the noise \(n\) having zero averages was considered (E(x) \(\ =\ 0\), E(n) \(\ =\ 0\), where E represents the statistical average). There is the problem of determining the Wiener filter, a filter that minimizes the average square error between the useful signal and its estimate (\(\hat{x}\ =\ Gy\)),  
\[\mathrm{G}_{wiener}\ =\ \underset{G}{\mathrm{arg\ min}}\ \mathrm{E}\Big{(} \left\|x-\hat{x}\right\|^{2}\Big{)} \tag{1}\]  
The autocorrelation matrix \(\mathrm{R}_{\mathrm{xx}}\) of the useful signal, with \(\mathrm{R}_{\mathrm{nn}}\) that of the noise and with \(\mathrm{R}_{\mathrm{yy}}\) that of the input signal was noted:  
\[\mathrm{R}_{\mathrm{xx}}\ =\ \mathrm{E}\Big{(}\mathrm{xx}^{T}\Big{)},\ \mathrm{R}_{\mathrm{nn}}\ =\ \mathrm{E}\Big{(}\mathrm{nn}^{T}\Big{)},\ \mathrm{R}_{\mathrm{yy}}\ =\ \mathrm{E}\Big{(}\mathrm{yy}^{T}\Big{)} \tag{2}\]  
The useful signal \(x\), and the noise \(n\), are uncorrelated processes, therefore:  
\[\mathrm{E}\Big{(}\mathrm{xn}^{T}\Big{)}\ =\ \mathrm{E}\Big{(}\mathrm{nx}^{T} \Big{)}\ =\ 0_{N} \tag{3}\]  
In this case, the mean square error made in estimating the signal \(x\) will be:  
\[\mathrm{E}\Big{(}\left\|x-\hat{x}\right\|^{2}\Big{)}\ =\ \mathrm{E}\Big{(} \left(\hat{x}-x\right)^{T}(\hat{x}-x)\Big{)} \tag{4}\]  
which through further development will be able to be written:  
\[\mathrm{E}\Big{(}\left\|x-\hat{x}\right\|^{2}\Big{)}\ =\ \mathrm{E}\Big{(} \mathrm{y}^{T}\mathrm{G}^{T}\mathrm{Gy}\Big{)}-2\mathrm{E}\Big{(}\mathrm{y}^{ T}\mathrm{G}^{T}x\Big{)}+\mathrm{E}\Big{(}\left\|x\right\|^{2}\Big{)} \tag{5}\]where G must be chosen so that the mean square error of estimation is minimal, the condition must be satisfied:  
\[\
abla_{\text{G}}\text{E}\left(\left\|\text{x}-\hat{\text{x}}\right\|^{2}\right) =\ 0_{\text{N}} \tag{6}\]  
that is, the gradient of the mean square estimation error relative to the matrix G is zero.  
This is how the relationship is reached:  
\[2\text{G}_{wiener}\left(\text{E}\left(\text{yy}^{\text{T}}\right)\right)-2 \text{xy}^{\text{T}}\ =\ 0_{\text{N}} \tag{7}\]  
which leads further to:  
\[\text{G}_{wiener}\left(\text{E}\left(\text{xx}^{\text{T}}+\text{nn}^{\text{T }}\right)\right)-\text{xx}^{\text{T}}\ =\ 0_{\text{N}} \tag{8}\]  
By introducing the autocorrelation matrices, we will have:  
\[\text{G}_{wiener}(\text{R}_{\text{xx}}+\text{R}_{\text{nn}})\ =\ \text{R}_{\text{xx}} \tag{9}\]  
or  
\[\text{G}_{wiener}\ =\ \text{R}_{\text{xx}}(\text{R}_{\text{xx}}+\text{R}_{ \text{nn}})^{-1} \tag{10}\]  
This relation establishes the optimal filter matrix according to the second order statistical properties of the useful signal and of the noise, respectively, according to the autocorrelation matrices of the useful signal, R\({}_{\text{xx}}\) and of the noise, R\({}_{\text{nn}}\).  
If the filter thus obtained is characterized by a diagonal matrix:  
\[\text{G}_{wiener}\ =\ \text{diag}(\text{g}_{0,0^{\prime}}\text{g}_{1,1}, \dots,\text{g}_{\text{N-1,N-1}}) \tag{11}\]  
we have a scalar filter.  
The importance of scalar filters lies in the fact that they simplify the calculation operations for estimating the useful signal. In general, however, the matrix G\({}_{\text{wiener}}\) is not a diagonal matrix, in which case we are dealing with a _vector filter_.