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 effect, to follow, not to force the public inclination; to give a direction, a form, a technical dress, and a specific sanction, to the general sense of the community, is the true end of legislature.
    Edmund Burke (1729–1797)

    Anyone can see that to write Uncle Tom’s Cabin on the knee in the kitchen, with constant calls to cooking and other details of housework to punctuate the paragraphs, was a more difficult achievement than to write it at leisure in a quiet room.
    Anna Garlin Spencer (1851–1931)