Sobel Operator - Technical Details

Technical Details

As a consequence of its definition, the Sobel operator can be implemented by simple means in both hardware and software: only eight image points around a point are needed to compute the corresponding result and only integer arithmetic is needed to compute the gradient vector approximation. Furthermore, the two discrete filters described above are both separable:

\begin{bmatrix}
-1 & 0 & 1 \\
-2 & 0 & 2 \\
-1 & 0 & 1
\end{bmatrix} = \begin{bmatrix}
1 \\
2 \\
1
\end{bmatrix} \begin{bmatrix}
-1 & 0 & 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}
\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}

and the two derivatives Gx and Gy can therefore be computed as


\mathbf{G}_x = \begin{bmatrix}
1 \\
2 \\
1
\end{bmatrix} * \left ( \begin{bmatrix}
-1 & 0 & 1
\end{bmatrix} * \mathbf{A} \right )
\quad \mbox{and} \quad
\mathbf{G}_y = \begin{bmatrix}
-1 \\
\ \ 0 \\
\ \ 1
\end{bmatrix} * \left ( \begin{bmatrix}
1 & 2 & 1
\end{bmatrix} * \mathbf{A} \right )

In certain implementations, this separable computation may be advantageous since it implies fewer arithmetic computations for each image point.

Applying convolution K to pixel group P can be represented in pseudocode as:

N(x,y) = Sum of { K(i,j).P(x-i,y-j)}, for i,j running from -1 to 1. N(x,y) represents the new matrix resulted after applying the Convolution K to P. where P is pixel matrix.

Read more about this topic:  Sobel Operator

Famous quotes containing the words technical and/or details:

    In middle life, the human back is spoiling for a technical knockout and will use the flimsiest excuse, even a sneeze, to fall apart.
    —E.B. (Elwyn Brooks)

    Then he told the news media
    the strange details of his death
    and they hammered him up in the marketplace
    and sold him and sold him and sold him.
    My death the same.
    Anne Sexton (1928–1974)