<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 98.1p1 release (March 2nd, 1998) originally by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>Digital Filters</TITLE> <META NAME="description" CONTENT="Digital Filters"> <META NAME="keywords" CONTENT="vol2"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <LINK REL="STYLESHEET" HREF="vol2.css"> <LINK REL="next" HREF="node21.html"> <LINK REL="previous" HREF="node19.html"> <LINK REL="up" HREF="node19.html"> <LINK REL="next" HREF="node21.html"> </HEAD> <BODY > <!--Navigation Panel--> <A NAME="tex2html1698" HREF="node21.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="icons.gif/next_motif.gif"></A> <A NAME="tex2html1695" HREF="node19.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="icons.gif/up_motif.gif"></A> <A NAME="tex2html1689" HREF="node19.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="icons.gif/previous_motif.gif"></A> <A NAME="tex2html1697" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="icons.gif/contents_motif.gif"></A> <BR> <B> Next:</B> <A NAME="tex2html1699" HREF="node21.html">Background Estimates</A> <B> Up:</B> <A NAME="tex2html1696" HREF="node19.html">Image Manipulations</A> <B> Previous:</B> <A NAME="tex2html1690" HREF="node19.html">Image Manipulations</A> <BR> <BR> <!--End of Navigation Panel--> <H2><A NAME="SECTION00531000000000000000"> Digital Filters</A> </H2> The analog detector output is normally converted into integer values so that the internal detector noise is resolved. This noise can be reduced by replacing the pixels with an average of the surrounding values using a linear filter. In general, the image <I>I</I>(<I>m</I>,<I>n</I>) is convolved by a filter function <I>F</I>(<I>i</I>,<I>j</I>) giving the smooth image <BR><P></P> <DIV ALIGN="CENTER"> <!-- MATH: \begin{equation} S(m,n) = \sum_{i=-k}^k \sum_{j=-l}^l I(m-i,n-j) F(i,j). \end{equation} --> <TABLE WIDTH="100%" ALIGN="CENTER"> <TR VALIGN="MIDDLE"><TD ALIGN="CENTER" NOWRAP><A NAME="eq:lin-filt"> </A><IMG WIDTH="399" HEIGHT="78" SRC="img69.gif" ALT="\begin{displaymath}S(m,n) = \sum_{i=-k}^k \sum_{j=-l}^l I(m-i,n-j) F(i,j). \end{displaymath}"></TD> <TD WIDTH=10 ALIGN="RIGHT"> (2.16)</TD></TR> </TABLE> </DIV> <BR CLEAR="ALL"><P></P> In principle, the image <I>S</I> is smaller than the original because the convolution is undefined along the edge. For convenience, extrapolated values for <I>F</I> are used to avoid this reduction in size after each filtering. Several different filter functions are used depending on the application. Two typical <!-- MATH: $3 \times 3$ --> <IMG WIDTH="54" HEIGHT="39" ALIGN="MIDDLE" BORDER="0" SRC="img70.gif" ALT="$3 \times 3$"> filters are given as examples, namely peaked smoothing filter <BR><P></P> <DIV ALIGN="CENTER"> <!-- MATH: \begin{equation} F_{smooth} = \frac{1}{16} \left( \begin{array}{ccc} 1 & 2 & 1 \\ 2 & 4 & 2 \\ 1 & 2 & 1 \end{array} \right) \end{equation} --> <TABLE WIDTH="100%" ALIGN="CENTER"> <TR VALIGN="MIDDLE"><TD ALIGN="CENTER" NOWRAP><A NAME="eq:smooth-filt"> </A><IMG WIDTH="251" HEIGHT="93" SRC="img71.gif" ALT="\begin{displaymath}F_{smooth} = \frac{1}{16} \left( \begin{array}{ccc} 1 & 2 & 1 \\ 2 & 4 & 2 \\ 1 & 2 & 1 \end{array} \right) \end{displaymath}"></TD> <TD WIDTH=10 ALIGN="RIGHT"> (2.17)</TD></TR> </TABLE> </DIV> <BR CLEAR="ALL"><P></P> and a constant 'block' filter <BR><P></P> <DIV ALIGN="CENTER"> <!-- MATH: \begin{equation} F_{block}= \frac{1}{9} \left( \begin{array}{ccc} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \end{array} \right) . \end{equation} --> <TABLE WIDTH="100%" ALIGN="CENTER"> <TR VALIGN="MIDDLE"><TD ALIGN="CENTER" NOWRAP><A NAME="eq:block-filt"> </A><IMG WIDTH="236" HEIGHT="93" SRC="img72.gif" ALT="\begin{displaymath}F_{block}= \frac{1}{9} \left( \begin{array}{ccc} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \end{array} \right) . \end{displaymath}"></TD> <TD WIDTH=10 ALIGN="RIGHT"> (2.18)</TD></TR> </TABLE> </DIV> <BR CLEAR="ALL"><P></P> Both filters are normalized to unity in order to preserve the total flux in the image. Depending on the actual size and shape of the filter, different degrees of smoothing are achieved (i.e. larger size gives stronger smoothing). Filter functions which vary significantly or are non-zero at the edge (e.g. Equation <A HREF="node20.html#eq:block-filt">2.18</A>) will tend to preserve some high frequencies in the output. The effects of applying linear filters to a CCD frame is shown in Figure <A HREF="node20.html#fig:dig-filt">2.6</A>. <BR> <DIV ALIGN="CENTER"><A NAME="fig:dig-filt"> </A><A NAME="674"> </A> <TABLE WIDTH="50%"> <CAPTION><STRONG>Figure 2.6:</STRONG> Different digital filters applied on a CCD image: (A) original, (B) block filter, (C) smooth filter, and (D) Laplacian filter.</CAPTION> <TR><TD><IMG WIDTH="879" HEIGHT="886" SRC="img73.gif" ALT="\begin{figure}\psfig{figure=fig6_different.eps,clip=} \end{figure}"></TD></TR> </TABLE> </DIV> <BR> It can be seen that the `block' filter leaves sharper features in the result frame than the `smooth' filter. This is avoided by taking a smooth function like a gaussian giving <BR><P></P> <DIV ALIGN="CENTER"> <!-- MATH: \begin{equation} F_{gaus} (j,k) = A \, \exp \left( -\frac{1}{2} \left[ \frac{j^2}{\sigma_x^2} + \frac{k^2}{\sigma_y^2} \right] \right) \end{equation} --> <TABLE WIDTH="100%" ALIGN="CENTER"> <TR VALIGN="MIDDLE"><TD ALIGN="CENTER" NOWRAP><A NAME="eq:gaus-filt"> </A><IMG WIDTH="355" HEIGHT="69" SRC="img74.gif" ALT="\begin{displaymath}F_{gaus} (j,k) = A \, \exp \left( -\frac{1}{2} \left[ \frac{j^2}{\sigma_x^2} + \frac{k^2}{\sigma_y^2} \right] \right) \end{displaymath}"></TD> <TD WIDTH=10 ALIGN="RIGHT"> (2.19)</TD></TR> </TABLE> </DIV> <BR CLEAR="ALL"><P></P> where <I>A</I> is a normalization constant and <IMG WIDTH="18" HEIGHT="21" ALIGN="BOTTOM" BORDER="0" SRC="img75.gif" ALT="$\sigma$"> defines the width of the filter. The parameters of the gaussian filter can normally be varied to satisfy most applications (see Equation <A HREF="node20.html#eq:gaus-filt">2.19</A>). <P> The increase in the <I>S</I>/<I>N</I> is paid by a degradation in the resolution. When a fixed filter is used this blurring affects the whole frame; although a smoothing may be required only in the low <I>S</I>/<I>N</I> regions. This problem can be avoided by applying a gaussian filter for which the width <IMG WIDTH="19" HEIGHT="21" ALIGN="BOTTOM" BORDER="0" SRC="img76.gif" ALT="$\sigma$"> is a function of the local S/N (e.g. <!-- MATH: $\sigma \propto N/S$ --> <IMG WIDTH="91" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img77.gif" ALT="$\sigma \propto N/S$">). <P> Other types of linear filters are used to emphasize edges and variations. They are based on differential operators like the Laplacian and have often <!-- MATH: $\sum \sum F = 0$ --> <IMG WIDTH="113" HEIGHT="42" ALIGN="MIDDLE" BORDER="0" SRC="img78.gif" ALT="$\sum \sum F = 0$"> to remove the mean level of the input frame. A symmetric edge detection filter may be defined as <BR><P></P> <DIV ALIGN="CENTER"> <!-- MATH: \begin{equation} F_{Laplace}= \left( \begin{array}{rrr} 1 & -2 & 1 \\ -2 & 4 & -2 \\ 1 & -2 & 1 \end{array} \right) \end{equation} --> <TABLE WIDTH="100%" ALIGN="CENTER"> <TR VALIGN="MIDDLE"><TD ALIGN="CENTER" NOWRAP><A NAME="eq:laplac-filt"> </A><IMG WIDTH="275" HEIGHT="93" SRC="img79.gif" ALT="\begin{displaymath}F_{Laplace}= \left( \begin{array}{rrr} 1 & -2 & 1 \\ -2 & 4 & -2 \\ 1 & -2 & 1 \end{array} \right) \end{displaymath}"></TD> <TD WIDTH=10 ALIGN="RIGHT"> (2.20)</TD></TR> </TABLE> </DIV> <BR CLEAR="ALL"><P></P> while a large variety of other filters may be constructed to enhance special features. The result of the <!-- MATH: $F_{Laplace}$ --> <I>F</I><SUB><I>Laplace</I></SUB> filter is shown in Figure <A HREF="node20.html#fig:dig-filt">2.6</A>. <P> In some cases types of objects (e.g. stars) may disturb the further analysis of an image. If these objects have a special appearance if is often possible to remove them with a non-linear filter (see Section <A HREF="node16.html#artifacts">2.2.1</A>). To remove stellar images from a picture of comet Halley, the results of applying different non-linear filters to the frame are given in Figure <A HREF="node20.html#fig:star-remove">2.7</A>. For more complicated features they are deleted from the image by interpolation between pixels in nearby regions. <BR> <DIV ALIGN="CENTER"><A NAME="fig:star-remove"> </A><A NAME="701"> </A> <TABLE WIDTH="50%"> <CAPTION><STRONG>Figure 2.7:</STRONG> Removal of stars from a CCD frame of Comet Halley: (A) original, (B) <!-- MATH: $5 \times 5$ --> <IMG WIDTH="54" HEIGHT="39" ALIGN="MIDDLE" BORDER="0" SRC="img84.gif" ALT="$5 \times 5$"> median filter, (C) <!-- MATH: $5 \times 1$ --> <IMG WIDTH="53" HEIGHT="39" ALIGN="MIDDLE" BORDER="0" SRC="img85.gif" ALT="$5 \times 1$"> recursive filter, and (D) both recursive <!-- MATH: $5 \times 1$ --> <IMG WIDTH="54" HEIGHT="39" ALIGN="MIDDLE" BORDER="0" SRC="img86.gif" ALT="$5 \times 1$"> filter and a <!-- MATH: $1 \times 3$ --> <IMG WIDTH="53" HEIGHT="39" ALIGN="MIDDLE" BORDER="0" SRC="img87.gif" ALT="$1 \times 3$"> median filter.</CAPTION> <TR><TD><IMG WIDTH="773" HEIGHT="1211" SRC="img88.gif" ALT="\begin{figure}\psfig{figure=fig7_comet.eps,clip=} \end{figure}"></TD></TR> </TABLE> </DIV> <BR> <P> <HR> <!--Navigation Panel--> <A NAME="tex2html1698" HREF="node21.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="icons.gif/next_motif.gif"></A> <A NAME="tex2html1695" HREF="node19.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="icons.gif/up_motif.gif"></A> <A NAME="tex2html1689" HREF="node19.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="icons.gif/previous_motif.gif"></A> <A NAME="tex2html1697" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="icons.gif/contents_motif.gif"></A> <BR> <B> Next:</B> <A NAME="tex2html1699" HREF="node21.html">Background Estimates</A> <B> Up:</B> <A NAME="tex2html1696" HREF="node19.html">Image Manipulations</A> <B> Previous:</B> <A NAME="tex2html1690" HREF="node19.html">Image Manipulations</A> <!--End of Navigation Panel--> <ADDRESS> <I>Petra Nass</I> <BR><I>1999-06-15</I> </ADDRESS> </BODY> </HTML>