The concept of a mask is also known as spatial filtering. Mask is a type of filter which performs operation directly on the image. The filter mask is also known as convolution mask.

To apply a mask on an image, filter mask is moved point to point on the image. In the original image, at each point(X, Y), filter is calculated by using a predefined relationship.

There are two types of filters:

1. Linear filter
2. Frequency domain filter

## Linear filter

A linear filter is the simplest filter. In linear filter, each pixel is replaced by the average of these pixel values. The entire linear filter works in the same way except when the weighted average is formed instead of a simple average.

The formula for a linear filter ### Example:  ## Frequency Domain Filter

In frequency domain filter, an image is represented as the sum of many sine waves which have different frequencies, amplitudes and directions. The parameter of sine waves is referred to as Fourier coefficients.

Reasons for using this approach:

1. For getting extra insight.
2. Linear filters can also in the frequency domain use Fast Fourier Transform (FFT) Filters are used for 2 purposes:

1. Blurring and noise reduction.
2. Edge detection and sharpness.

### Blurring and noise reduction

Filters can be used for blurring as well as noise reduction from an image. Blurring is used to remove small details from an image. Noise reduction can also be done with the help of blurring.

Commonly used masks for blurring are:

1. Box filter
2. Weighted average filter

### Edge Detection and sharpness

Filters can be used for edge detection and sharpness. To increase the sharpness of an image, edge detection is used.

### Feedback   