4
$\begingroup$

I am new to signal processing, and was reading about filters. I came upon the Sobel filter which has the following forms,

$\textbf{G}_x = \begin{bmatrix}+1 & 0 & -1\\+2 & 0 & -2\\+1 & 0 & -1 \end{bmatrix} * \textbf{A}$ and $\textbf{G}_y = \begin{bmatrix}+1 & +2 & +1\\0 & 0 & 0\\-1 & -2 & -1 \end{bmatrix} * \textbf{A}$

From what I understand to apply this filter to a 2-d signal, place the filter's center on the correct point and multiply the coefficients with the signal at the points of overlap and add them together. So for the following example signal, applying the horizontal sobel filter from above would give:

Signal                 Output (edges are left alone)
|100|100|100|100|      |100| 100| 100|100|
| 10| 10| 10| 10|      | 10| 360| 360| 10|
| 10| 10| 10| 10|      | 10|-360|-360| 10|
|100|100|100|100|      |100| 100| 100|100|

Separable filters are more computationally efficient and the Sobel filter is one of them. My problem is I can't figure out how the separable filter is applied. So, what I want to ask is how would the Sobel filter be applied separably?

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

$\endgroup$
1
  • $\begingroup$ Could you please review the answers? $\endgroup$
    – Royi
    Commented Jul 2, 2023 at 19:09

2 Answers 2

7
$\begingroup$

Steve Eddins has a nice page that explains it.

It comes down to being able to do a separate 1-D filters in each direction (requiring $MN(P + Q)$ multiplies and adds), rather than a single 2-D convolution ($MNPQ$ multiplies and adds). Here the image is assumed to be $M \times N$ and the convolution kernel $P \times Q$.

Of course, this assumes you're doing everything in the time domain, and not using FFTs.

$\endgroup$
1
$\begingroup$

Attaching an example to show how to apply a separable filter to data.

separable_example

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.