MASTERCLASS

# Spatial operators

### Lessons

#### Share

#### Transcript

Let’s summarise some of the things we have learned: in this lecture we talked about spatial image processing operators. These operations are where the output pixel is a function of the corresponding surrounding region in the input image.

We talked about edge effects and this where the input window falls off the edge of the input image and we need some sort of strategy to deal with this particular problem.

We talked about convolution; this is where we apply a matrix which we call a kernel to an image using the convolution operator. We can use this to perform a raft of really useful image processing functions such as smoothing and gradient calculation.

We looked at a number of standard kernels such as the Gaussian, the derivative of the Gaussian and the Laplacian of Gaussian.

We also looked at the correlation. Correlation is similar to convolution; some of the signs in the equation are changed and it’s equivalent to convolution if the kernel is symmetric.

Correlation is useful for tasks such as template matching and we used this technique to find the robot Bender in a very busy crowd scene.

We also discussed non-linear filters; we talked about rank and median filters and showed how they are useful for removing extreme noise.

We also talked about morphological image processing, and this is a technique that allows us to keep or remove blobs that are based on their size and shape. If you have an image with small noise blobs you can use a morphological filter to simply remove them. Or if you have an image—perhaps the result of thresholding, the object has got some small holes in it that you are not happy about — you can use a morphological processing to fill those holes in.

Let’s recap the important points about spatial operators. Linear operators can be used to smooth images and determine gradients. Template matching can be used to find a face in a crowd. Non-linear operators such as rank filters can be used for noise removal, and mathematical morphology treats shapes according to their compatibility with a structuring element.

### Skill level

MATLAB experience

This content assumes an understanding of high school level mathematics; for example, trigonometry, algebra, calculus, physics (optics) and experience with MATLAB command line and programming, for example workspace, variables, arrays, types, functions and classes.