Revision 56951127715517cc9c5575fe800547352fe5823f (click the page title to view the current version)

Filters

Changes from 56951127715517cc9c5575fe800547352fe5823f to 47b5cb064f06e97ccc753a7419c8f8bfa4f24eb4

---
title: Filters
categories: lecture
---

### Convolution
# What are filters

$$f[x]*h(x) = \sum_{k=-\infty}^{\infty} f[k]h(x-k)$$
Today we will investigate the use of blurring filters on images.
This is just one of many applications of filters in image processing,
and in the next session we will use the same basic techniques for
feature detection.

Blurring filters do exactly what it says on the tin.  They blur the
image.  This has the effect of smoothing out noise, so it is a useful
technique for noise removal.

One of the groups using machine vision in the final year project
last year had problems with the camera failing to return a value in
some pixel.  The result was black pixels, so-called pepper noise.
A blurring filter solves this problem very effectively.

If you have read signal processing or image processing previously,
all of this may be familiar to you already.

## Conceptual Application

+ Recalculate pixels using a neighbourhood
+ Use a matrix of coefficients for a weighted average

## Convolution

$$(f*g)[x] = \sum_{k=-\infty}^{\infty} f[k]g[x-k]$$

+ Note the convolution of a sampled signal and a continuous one
+ [Demo](https://youtu.be/HW4IamyQnzw)

**Note** OpenCV uses correlation instead of convolution.
Conceptually this is different, but in practice, the only effect
is to mirror the filter.

$$(f\star g)[x] = \sum_{k=-\infty}^{\infty} f[k]g(k+x)$$