{{Short description|Signal filtering technique}} {{distinguish|top-hat transform}} {{Use British English|date=April 2024}} {{One source|date=May 2024}}

thumb|250px|right '''Top-hat filters''' are several real-space or Fourier space filtering techniques.<ref>{{cite book |last1=Broughton |first1=S. A. |first2=K. |last2=Bryan<!--|authorlink2=Karin Bryan--> |year=2008 |title=Discrete Fourier Analysis and Wavelets: Applications to Signal and Image Processing |location=New York |publisher=Wiley |page=72}}</ref> The name top-hat originates from the shape of the filter, which is a rectangle function, when viewed in the domain in which the filter is constructed.

==Real space== In real-space the filter performs nearest-neighbour filtering, incorporating components from neighbouring y-function values. Despite its ease of implementation, its practical use is limited as the real-space representation of a top-hat filter is the sinc function, which has the often undesirable effect of incorporating non-local frequencies.

===Analogue implementations=== Exact non-digital implementations are only theoretically possible. Top-hat filters can be constructed by chaining theoretical low-band and high-band filters. In practice, an approximate top-hat filter can be constructed in analogue hardware using approximate low-band and high-band filters.

==Fourier space== In Fourier space, a top hat filter selects a band of signal of desired frequency by the specification of lower and upper bounding frequencies. Top-hat filters are particularly easy to implement digitally.

== Related functions == The top hat function can be generated by differentiating a linear ramp function of width <math>\epsilon</math>. The limit of <math>\epsilon</math> then becomes the Dirac delta function. Its real-space form is the same as the moving average, with the exception of not introducing a shift in the output function.

==See also== * Boxcar averager * Rectangular function * Step function * Boxcar function

==References== {{reflist}}

Category:Linear filters