Separable filter explained

A separable filter in image processing can be written as product of two more simple filters.Typically a 2-dimensional convolution operation is separated into two 1-dimensional filters. This reduces the computational costs on an

N x M

image with a

m x n

filter from

l{O}(M ⋅ Nmn)

down to

l{O}(M ⋅ N(m+n))

. [1]

Examples

1. A two-dimensional smoothing filter:

1
3

\begin{bmatrix}1\ 1\ 1\end{bmatrix}*

1
3

\begin{bmatrix}1&1&1 \end{bmatrix} =

1
9

\begin{bmatrix}1&1&1\ 1&1&1\\ 1&1&1 \end{bmatrix}

2. Another two-dimensional smoothing filter with stronger weight in the middle:

1
4

\begin{bmatrix}1\ 2\ 1\end{bmatrix}*

1
4

\begin{bmatrix}1&2&1 \end{bmatrix} =

1
16

\begin{bmatrix}1&2&1\ 2&4&2\\ 1&2&1 \end{bmatrix}

3. The Sobel operator, used commonly for edge detection:

\begin{bmatrix}1\ 2\ 1\end{bmatrix} * \begin{bmatrix}1&0&-1 \end{bmatrix} = \begin{bmatrix} 1&0&-1\\ 2&0&-2\\ 1&0&-1\end{bmatrix}

This works also for the Prewitt operator.

In the examples, there is a cost of 3 multiply–accumulate operations for each vector which gives six total (horizontal and vertical). This is compared to the nine operations for the full 3x3 matrix.

Another notable example of a separable filter is the Gaussian blur whose performance can be greatly improved the bigger the convolution window becomes.

Notes and References

  1. Web site: Learning Separable Filters. 2021-01-06. 3. https://web.archive.org/web/20200709094810/https://www.cv-foundation.org/openaccess/content_cvpr_2013/papers/Rigamonti_Learning_Separable_Filters_2013_CVPR_paper.pdf. 2020-07-09.