Filtering can be done in two ways: either in the frequency domain, which is called Fourier analysis, or in the spatial domain, where it is called convolution. For speed reasons simple convolution in the spatial domain is the most common technique used in machine vision.
Anyone who has used image editing software to enhance photos will know that smoothing tools reduce noise and blur edges, while edge enhancement amplifies the edges to make them look sharper.
In machine vision, filtering is mostly used to reduce noise, or to highlight a specific detail while suppressing others. A good example of this can be seen in edge filtering, as shown in the images.