Sobel Operator - Formulation

Formulation

Mathematically, the operator uses two 3×3 kernels which are convolved with the original image to calculate approximations of the derivatives - one for horizontal changes, and one for vertical. If we define A as the source image, and Gx and Gy are two images which at each point contain the horizontal and vertical derivative approximations, the computations are as follows:


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

where here denotes the 2-dimensional convolution operation.

Since the Sobel kernels can be decomposed as the products of an averaging and a differentiation kernel, they compute the gradient with smoothing. For example, can be written as


\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}

The x-coordinate is defined here as increasing in the "right"-direction, and the y-coordinate is defined as increasing in the "down"-direction. At each point in the image, the resulting gradient approximations can be combined to give the gradient magnitude, using:

Using this information, we can also calculate the gradient's direction:

where, for example, Θ is 0 for a vertical edge which is darker on the right side.

Read more about this topic:  Sobel Operator

Famous quotes containing the word formulation:

    You do not mean by mystery what a Catholic does. You mean an interesting uncertainty: the uncertainty ceasing interest ceases also.... But a Catholic by mystery means an incomprehensible certainty: without certainty, without formulation there is no interest;... the clearer the formulation the greater the interest.
    Gerard Manley Hopkins (1844–1889)

    Art is an experience, not the formulation of a problem.
    Lindsay Anderson (b. 1923)

    In necessary things, unity; in disputed things, liberty; in all things, charity.
    —Variously Ascribed.

    The formulation was used as a motto by the English Nonconformist clergyman Richard Baxter (1615-1691)