Someone asked me this question the other day:** What are the benefits and limitations of applying an image processing application such as noise reduction using mathematical morphology vs. convolution?**

Before we get into the pros and cons of mathematical morphology and convolutions filters applied to noise reduction in images, let us take a look at the definitions of these terms.

**Mathematical morphology** is an image processing technique based on two operations: erosion and dilation. Erosion enlarges objects in an image, while dilation shrinks objects in an image.

**Convolution filtering** involves taking an image as input and generating an output image where each new pixel value is determined by the weighted values of itself and its neighboring pixels.

**Noise reduction** involves “cleaning up” an image. The goal is to take an image as input and get rid of all the unnecessary elements in that image so that it looks better.

Below are the pros and cons of doing noise reduction using mathematical morphology vs. convolution filters.

# Mathematical Morphology

## Pros

- Simplicity from a theoretical perspective (it is based on basic set theory)
- Simplicity from an operational perspective (can be implemented with a few lines of code: https://docs.opencv.org/2.4/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.html)
- Computationally efficient
- Useful for removing noise in grayscale images
- Useful for detaching two objects that are connected together (erosion)
- Useful for connecting an object that is broken apart in an image (dilation)
- Can remove noise without substantially altering the underlying shape of an object

## Cons

- Noise reduction is limited by the tendency to remove important, thin features from an image along with the noise (Source: https://www.ncbi.nlm.nih.gov/pubmed/18290006)

# Convolution Filters

## Pros

- Simple theoretically (a convolution is element-wise multiplication of two matrices followed by a sum)
- Flexiblity (can use different kernels and techniques to see which ones work best)
- Can be parallelized using GPUs
- Fast to implement (https://docs.opencv.org/2.4/doc/tutorials/imgproc/imgtrans/filter_2d/filter_2d.html)

## Cons

- More complicated from an operational perspective (so many techniques and kernels to choose from…how does one decide which one is best?)
- Can remove important image gradients because filter output is proportional to the contrast of a given section of an image
- Shape of an object can become altered or distorted