
While discussing filtering in the spatial domain we mentioned a filtering mask, which is used to convolute with the image. These masks are generated depending on their purpose, such as smoothing, edge detection, edge enhancement, etc. The filters are decided by a given size $m \times n$ and with the use of a mathematical function one can calculate the values of the filter discretely. We will later see that the nature of the function used will result in how well the filter will perform. 

\subsection*{Gaussian Smoothing}
Using a Gaussian filter, also known as Gaussian smoothing, is an operator that is used to blur images and remove detail and noise. This is similar to the way a mean filter works, but the Gaussian filter uses a different kernel. This kernel is represented with a Gaussian bell shaped bump. This kernel has some special properties regarding separability that we will look at in detail.

\begin{equation}
G(x) = \frac{1}{\sqrt[]{2 \pi } \sigma} e^{- \frac{x^{2}}{2 \sigma ^{2}}}
\label{1dgaussian}
\end{equation}

\begin{equation}
G(x,y) = \frac{1}{2 \pi \sigma ^{2}} e^{- \frac{x^{2} + y^{2}}{2 \sigma ^{2}}}
\label{2dgaussian}
\end{equation}

The Gaussian distribution in the 1D and 2D cases are shown in Equations \ref{1dgaussian} and \ref{2dgaussian} (from \cite{Gonzales}), where $\sigma$ is the standard deviation of the distribution. The functions are illustrated in Figure \ref{gauss1}. These can be used to give a better idea of what a Gaussian distribution is. The idea of Gaussian smoothing is to use these distributions as a point spread function to create a filtering mask and by using convolution one is able to blur an image. Since images are usually stored as discrete pixel values one would have to use a discrete approximation of the Gaussian function on the filtering mask before performing the convolution. See Figure \ref{gaussmask} to see an example of a discrete approximation of a gausian filter in two dimensions.

\begin{figure}[h]
\centering
\includegraphics[width=7cm]{report/background/gauss1.PNG}
\caption{2D Gaussian distribution graph drawn in online 3D grapher $^1$}
\label{gauss1}
\end{figure}
\footnotetext[1]{http://www.livephysics.com/ptools/online-3d-function-grapher.php, accessed 2009-12-09. Available to all since it is public domain}

\subsection*{Gaussian Filter Mask in Practice}
In theory the Gaussian distribution is non-zero, which would imply an infinitely large convolution kernel. But, in practice it proves to be 'almost zero' more than three standard deviations from the mean. This implies that the kernel can be truncated after three standard deviations. Once a suitable kernel has been calculated then the Gaussian smoothing can be performed using a discrete convolution method as explained earlier. The Gaussian filter is separable if \textit{circularly symmetric} meaning that one can use a one dimensional filter to filter images. For example if the image is three dimensional then one can convolute three times using a one dimensional filtering mask, once in each dimension. If the Gaussian function is \textit{elliptical} than it is not separable and this would result in using a three dimensional filter once in all three dimensions. 

\begin{figure}[h]
\centering
\includegraphics[width=6cm]{report/background/gausmask.PNG}
\caption{Example of two dimensional Gaussian Filter Mask with discrete values}
\label{gaussmask}
\end{figure}