The Art of Interface

# Filter window, or filter mask

Category. Digital signal and image processing (DSP and DIP) software development.

Abstract. The article deals with the basic concept of signal and image processing science — filter window, or filter mask. Article explains what filter window is and demonstrates window idea for 1D, 2D and 3D cases.

Reference. Have a look at practical utilization of window idea in a simple case: mean filter, or average filter.

## 1. Introduction to filter window, or filter mask

Practically filter window or filter mask is just a selection pattern. Usually digital filter performs the same actions for every element of the signal or image. For its actions filter uses the neighbor elements as input. Every element has its own neighborhood but the pattern for picking up elements around is the same.

Simple filters usually have one fixed window. More complicated filters, for instance, adaptive ones, can switch window size on fly according to the prior estimation they make. Other filters, for example, hybrid ones, can apply several selection patterns to the same neighborhood — they use several masks.

Now let us look at filter window closer.

## 2. Filter window or mask

Let us imagine, you should read a letter and what you see in text restricted by hole in a special stencil like this.

Fig. 1. First stencil.

So, the result of reading is sound [t]. Ok, let us read the letter again, but with the help of another stencil:

Fig. 2. Second stencil.

Now the result of reading t is sound [ð]. Let us make the third try:

Fig. 3. Third stencil.

Now you are reading letter t as sound [θ].

What happens here? To say that in mathematical language, you are making an operation (reading) over element (letter t). And the result (sound) depends on the element neighborhood (letters next to t).

And that stencil, which helps to pick up element neighborhood, is window! Yes, window is just a stencil or pattern, by means of which you are selecting the element neighborhood — a set of elements around the given one — to help you make decision. Another name for filter window is mask — mask is a stencil, which hides elements we are not paying attention to.

In our example the element we are operating on positioned at leftmost of the window, in practice however its usual position is the center of the window.

Let us see some window examples. In one dimension.

Fig. 4. Window or mask of size 5 in 1D.

In two dimensions.

Fig. 5. Window or mask of size 3×3 in 2D.

In three dimensions... Think about building. And now — about room in that building. The room is like 3D window, which cuts out some subspace from the entire space of the building. You can find 3D window in volume (voxel) image processing.

Fig. 6. Window or mask of size 3×3×3 in 3D.

All our sample windows are of square form, and in practice digital filters usually utilizing that form. But indeed the window form could be any. For example, image filter can use x-like mask for picking up elements.

 Write to the author of the article — Sergey Chernenko